How to plot iterations?
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi I have this simple code and I would like to make graph between rez_p and iterations. I have created this, but the plot, that is coming out is blank. Could you please tell me, what I am doing wrong? Thank you so much.
nx=80;
nx=40;
nit=30000;
for it=1:nit
A=Pn-P; %Pn and P is matrix 81x41.. I dont have it here
sou=0.0;
for i=1:nx+1
for j=1:ny+1
sou=sou+A(i,j)*A(i,j);
end
end
rez_p=sqrt(sou)/(nx*ny);
if mod(it,30000)==0 || it ==1; %plot
figure
plot(it, rez_p)
end
end
1 Kommentar
KALYAN ACHARJYA
am 15 Aug. 2019
I have created this, but the plot, that is coming out is blank
Because rez_p return as single value,not range of values. See the @Star answered, he cretes a rez_p(it) with equal length of it.
for ...
end
it=1:nit;
plot(it,rez_p)
Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations 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!