How to plot iterations?

22 visualizaciones (últimos 30 días)
Lenk Lenk
Lenk Lenk el 15 de Ag. de 2019
Comentada: KALYAN ACHARJYA el 15 de Ag. de 2019
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 comentario
KALYAN ACHARJYA
KALYAN ACHARJYA el 15 de Ag. de 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)

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by