How to plot iterations?
17 views (last 30 days)
Show older comments
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 Comment
KALYAN ACHARJYA
on 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)
Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!