Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Semilog Plot of Relative Residual Norms in GMRES

Subject: Semilog Plot of Relative Residual Norms in GMRES

From: Ashley Daly

Date: 13 Apr, 2009 14:55:03

Message: 1 of 2

Hi, I need to plot the relative residual norms in each iteration for three systems, and all three sets of norms must appear in the same semilog plot, all starting with the intial residual r_0. It says to use outputs from gmres to set the x-coordinates in the plot. Here is the program I wrote for the three different gmres systems:

n=100
tol=10^(-6)
A=gallery('toeppen',n);
b=ones(n,1);
[x,flag,relres,iter]=gmres(A,b)
%Use as preconditioner the incomplete LU factorization of level 0.
[L1,U1]=luinc(A,'0');
[x1,flag,relres1,iter1]=gmres(A,b,n,tol,n,L1,U1)
%Use as preconditioner the incomplete LU factorization with drop tolerance
%10^-2.
droptol=10^(-2)
[L2,U2]=luinc(A,droptol);
[x2,flag,relres2,iter2]=gmres(A,b,n,tol,n,L2,U2)

I tried reading up on semilog, but I still don't understand it. I tried doing semilog(relres), but I know I am missing things because it's coming up with a pair of axes but no plot. Can anyone help? Thank you so much.

Subject: Semilog Plot of Relative Residual Norms in GMRES

From: Ashley Daly

Date: 13 Apr, 2009 15:09:01

Message: 2 of 2

I think I figured it out. Can anyone tell me if they think this works?

k=0:length(resvec)-1;
k1=0:length(resvec1)-1;
k2=0:length(resvec2)-1;
semilogy(k,resvec/norm(b),k,resvec/norm(b),'o'),hold on,semilogy(k1,resvec1/norm(b),k1,resvec1/norm(b),'o'),hold on,semilogy(k2,resvec2/norm(b),k2,resvec2/norm(b),'o')

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us