Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

how to create surface plot during each time calculation for several times?

1 visualizzazione (ultimi 30 giorni)
Greeting to instructors:
I tried to create 6 surface plots, 2 plots each time. The coding logic is below:
XP=linspace(0,1,50); YP=linspace(0,1,50); [X,Y]=meshgride(XP,YP);
for i=1:3
----
A1=some function of X and Y, A2=another function form of X and Y;
figure
mesh(X,Y,A1)
figure
mesh(X,Y,A2)
end
MatLab gives me 6 figures without curves in it.
I modify my code to another form, using subplot command, as below
XP=linspace(0,1,50); YP=linspace(0,1,50); [X,Y]=meshgride(XP,YP);
for i=1:3
----
A1=some function of X and Y, A2=another function form of X and Y;
subplot(3,2,2*i-1)
mesh(X,Y,A1)
subplot(3,2,2*i)
mesh(X,Y,A2)
end
this time, Matlab gives me 2 plots without curve in it. Could you teach me how to create 6 correct figures. Your kindly helps will be deeply appreciated. With best regards,
Donyau

Risposte (1)

Walter Roberson
Walter Roberson il 26 Giu 2016
It is likely that your X or your Y or your A1 and A2 are empty or consist of a single point.
If you are using division in your formula, make sure you use ./ instead of / as the operator.
  3 Commenti
Walter Roberson
Walter Roberson il 28 Giu 2016
All of your A6 is infinite. This is due to your A5 being quite large, on the order of 10^214 or more in the real and imaginary parts.
Not all of your A4 is infinite, but all of the part that is selected for plotting is.
The first 4 plots look okay to me when I try.
Donyau Chiang
Donyau Chiang il 29 Giu 2016
Dear Mr. Roberson, If I used z0=15, I can have the results. If I used z=20 and have the result. I used z=30, I also can have result. But if I try to use "for" command to calculate all three results at the same time. I do not know how to do it because the MatLab gives me the 6 frames, but no curve in the frame. That means I can obtain the all results when I calculate three times, but I can not obtain all results at one time. I think I use the wrong plot command --figure. What is the correct command do I use? The attached file is all calculated results of A4 and A6 for z0=15, 20, and 30. They are not infinite. I just want to know how to obtain all three results at one time. regards, Donyau

Questa domanda è chiusa.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by