How to plot iterations?

22 次查看(过去 30 天)
Lenk Lenk
Lenk Lenk 2019-8-15
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 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2019-8-15
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)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by