Borrar filtros
Borrar filtros

how can plot error with number of iteration?

2 visualizaciones (últimos 30 días)
Mary Jon
Mary Jon el 14 de Nov. de 2013
Comentada: Azzi Abdelmalek el 15 de Nov. de 2013
when used (while loop) as stopping condition of process ,we specified the value of error may be 0.001 or 0.00001
if I have number of iteration ,How can plot the error with iteration numbers?
  2 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 14 de Nov. de 2013
This is not clear
Mary Jon
Mary Jon el 14 de Nov. de 2013
if I have 120 iteration ,how can plot its
this code of error ,
[i j]=ndgrid(1:111,1:33);
G=(sum(sum((abs(v_now-v_prev)))));
MPD=G/(m*n); %error stoping criteria
while(MPD>0.00001); %Run this until convergence

Iniciar sesión para comentar.

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 14 de Nov. de 2013
[i j]=ndgrid(1:111,1:33);
MPD=1;
while(MPD>0.00001);
G=(sum(sum((abs(v_now-v_prev)))));
MPD=G/(m*n);
% your code
end
  8 comentarios
Mary Jon
Mary Jon el 15 de Nov. de 2013
iter=0;
[i j]=ndgrid(1:111,1:33);
MPD=1;
G=(sum(sum((abs(v_now-v_prev)))));
MPD=G/(m*n); %error stoping criteria
while(MPD>0.00001); %Run this until convergence
iter=iter+1; % Iteration counter increment
hold on
plot(MPD,iter)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%end of code %%%%%%%%%%%%
Azzi Abdelmalek
Azzi Abdelmalek el 15 de Nov. de 2013
You are not doing anything inside the loop. Try
iter=0;
MPD=1;
while(MPD>0.00001); %Run this until convergence
G=(sum(sum((abs(v_now-v_prev)))));
MPD=G/(m*n); %error stoping criteria
iter=iter+1; % Iteration counter increment
hold on
plot(iter,MPD)
end

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by