Plotting combaine stream function
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi;
Please, I have two matrix R(100*1) and Y(100*1). I used below code to plot stream function and its work properly. I got 100 plots.However, I have a more difficult situation. Now I am trying to combine stream function. I mean I have 100 steps to plot this mean I will have 100 plots.One plot for each step. My new case is combining stream function after each 5 steps.
This mean from step 1-5 the plots it will be the same but for step 6 the stream function will be stream function in step 1 plus stream function in step 6, For step 7 it will be step 2 plus step 7 and so on until I reach step 11 which will be stream function for step 1+6+11. and so on. I have to add stream function for every 5 steps.
Stream function from step 1-5 same as old stream function
Stream function from step 6-10 will be
Stream function from step 6 will be step 1 from old stream function+step 6 from old stream function
Stream function from step 7 will be step 2 from old stream function+step 7 from old stream function and so on for next step until step 10
Stream function from step 11-15 will be
Stream function from step 11 will be step 1 from old stream function+step 6 from old stream function+step 11 from old stream function
Stream function from step 12 will be step 2 from old stream function+step 7 from old stream function+step 12 from old stream function and so on for next step until step 15
and so on until I reach step 100
I can accomplish that by making a 3D matrix (for one stream function) each slide will be stream function at one step and to get new combination stream function I will add these slides each 5 steps. For example, Stream function at step 6 will be slide 1+6 and for 11 will be 1+6+11 and so on but this will consume long time to get the result.
What is the best way to accomplish that?
mkdir('MatLab')
pridir = 'MatLab';
for i=1:100
R= R1(i);
Y= Y1(i);
figure('units','normalized','outerposition',[0 0 1 1])
[r,y]= meshgrid(linspace(0,4),linspace(0,4));
k=((r*R)/((y-Y)^2+(r+R)^2));
U=exp(k-R.^2-Y.^2)
[~,h] = contour(r,y,U,[0.001 0.01 0.05 0.08 0.1 0.2 0.25 0.3 0.4]);
set(h,'ShowText','on','TextStep',get(h,'LevelStep')*2)
colormap cool
xlabel('r')
ylabel('y')
grid on
axis square
printto = sprintf('%s\\MatLab%03d',pridir,i);
print('-djpeg90',printto)
close(gcf);
end
Thank you.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!