mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
Tutorial case to create a recurrence matrix.
This commit is contained in:
75
tutorials/rStatAnalysis/createRecurrenceMatrix/CFD/recMat/getRecMat.m
Executable file
75
tutorials/rStatAnalysis/createRecurrenceMatrix/CFD/recMat/getRecMat.m
Executable file
@ -0,0 +1,75 @@
|
||||
% open files
|
||||
fid1 = fopen('../recurrenceMatrix');
|
||||
|
||||
% read dimensions
|
||||
A1 = fscanf(fid1, '%g %g');
|
||||
|
||||
% skip the first two lines
|
||||
tline = fgetl(fid1);
|
||||
tline = fgetl(fid1);
|
||||
|
||||
% get dimensions
|
||||
N1 = A1(1)
|
||||
M1 = A1(2)
|
||||
|
||||
% allocate space
|
||||
B0 = zeros(M1,N1);
|
||||
|
||||
% read data
|
||||
for i=1:N1
|
||||
B0(:,i) = fscanf(fid1, '%g', inf);
|
||||
tline = fgetl(fid1);
|
||||
tline = fgetl(fid1);
|
||||
end
|
||||
|
||||
% close files
|
||||
fclose(fid1);
|
||||
|
||||
|
||||
% skip this many leading entries
|
||||
sle = 0;
|
||||
|
||||
B1 = zeros(M1-sle,N1-sle);
|
||||
|
||||
B1 = B0(1+sle:M1,1+sle:N1);
|
||||
|
||||
maxval=0.0;
|
||||
%for i=1:M1
|
||||
% for j=1:N1
|
||||
% if(B1(i,j)>maxval)
|
||||
% maxval=B1(i,j);
|
||||
% endif
|
||||
% end
|
||||
%end
|
||||
|
||||
maxval = 1.0;
|
||||
for i=1:M1-sle
|
||||
for j=1:N1-sle
|
||||
B1(i,j)=1-B1(i,j)/maxval;
|
||||
% B1(i,j)=B1(i,j)/maxval;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
% write full matrix to simple text file
|
||||
dlmwrite('myMatrix.txt',B1,'delimiter','\t','precision',3)
|
||||
|
||||
|
||||
|
||||
%plot(C1)
|
||||
%saveas(gcf,'Plot','png')
|
||||
|
||||
%B1=B1*1;
|
||||
|
||||
|
||||
%hold on
|
||||
|
||||
|
||||
%colormap(jet(50))
|
||||
%imagesc(B1)
|
||||
%colorbar
|
||||
|
||||
%saveas(gcf,'Figure','png')
|
||||
|
||||
|
||||
7
tutorials/rStatAnalysis/createRecurrenceMatrix/CFD/recMat/makePlot.tex
Executable file
7
tutorials/rStatAnalysis/createRecurrenceMatrix/CFD/recMat/makePlot.tex
Executable file
@ -0,0 +1,7 @@
|
||||
\documentclass[preview]{standalone}
|
||||
\usepackage{graphicx}
|
||||
\begin{document}
|
||||
\begin{figure}
|
||||
\input{myDistMatrix}
|
||||
\end{figure}
|
||||
\end{document}
|
||||
4
tutorials/rStatAnalysis/createRecurrenceMatrix/CFD/recMat/plot.sh
Executable file
4
tutorials/rStatAnalysis/createRecurrenceMatrix/CFD/recMat/plot.sh
Executable file
@ -0,0 +1,4 @@
|
||||
octave getRecMat.m
|
||||
gnuplot plotDistMat.gnu
|
||||
pdflatex makePlot.tex
|
||||
pdfcrop makePlot.pdf distMatrix.pdf
|
||||
47
tutorials/rStatAnalysis/createRecurrenceMatrix/CFD/recMat/plotDistMat.gnu
Executable file
47
tutorials/rStatAnalysis/createRecurrenceMatrix/CFD/recMat/plotDistMat.gnu
Executable file
@ -0,0 +1,47 @@
|
||||
reset
|
||||
clear
|
||||
|
||||
set terminal cairolatex pdf dash dl 1
|
||||
|
||||
set pm3d map
|
||||
set contour surface
|
||||
set cntrparam levels discr 10
|
||||
set samples 50
|
||||
set isosamples 50
|
||||
|
||||
set palette maxcolors 8
|
||||
set palette defined(\
|
||||
0 0.2314 0.2980 0.7529,\
|
||||
0.125000 0.384300 0.509800 0.917600,\
|
||||
0.250000 0.552900 0.690200 0.996100,\
|
||||
0.375000 0.721600 0.815700 0.976500,\
|
||||
0.500000 0.866700 0.866700 0.866700,\
|
||||
0.625000 0.960800 0.768600 0.678400,\
|
||||
0.750000 0.956900 0.603900 0.482400,\
|
||||
0.875000 0.870600 0.376500 0.302000,\
|
||||
1 0.7059 0.0157 0.1490\
|
||||
)
|
||||
|
||||
set cbtics 0.6
|
||||
set mcbtics 8
|
||||
#set cblabel 'distance'
|
||||
#unset cbtics
|
||||
set cbrange [0:0.6]
|
||||
set format cb "%.1f"
|
||||
|
||||
set xrange[0:3]
|
||||
set yrange[0:3]
|
||||
|
||||
set xlabel 't [s]'
|
||||
set ylabel 't [s]'
|
||||
|
||||
set xtics 2
|
||||
set ytics 2
|
||||
set mxtics 2
|
||||
set mytics 2
|
||||
|
||||
set size square
|
||||
|
||||
|
||||
set out 'myDistMatrix.tex'
|
||||
splot 'myMatrix.txt' matrix using ($1/200):($2/200):(1-$3) with image notitle
|
||||
Reference in New Issue
Block a user