Thread Subject: trying to define my answer

Subject: trying to define my answer

From: Sean Douglas

Date: 18 Aug, 2009 19:54:02

Message: 1 of 1

Hey guys, I am attempting to find the backward error of this program. This m-file I am showing here is showing an answer of a 100 X 1 matrix with the answer being 1.0000 for each entry . My thinking is I can find the backward error if I can multiply my (a) matrix times this 100 x 1 matrix ( my answer from this m-file) I think, even though the correct answer is a 100 x 1 matrix of all ones, that when I multiply my (a) matrix by the answer I and then subtract that from my (b) I will be able to see my backward error.
So my big problem I think is trying to define my answer which I believe to be some form of x or x(i) from my m-file.
Please help me define my answer ( the last line of my m-file is one of my many attempts at defining my answer) If you have any questions to help make this clearer please let me know.
Btw my I am trying to iterate this until my error is < .5 x 10^-6 , I think I set that part up right

My m-file is below:

function x = jacobigstol(a,b,k)
n=length (b); % find n
d=diag(diag(a));
u=triu(a,1);
l=tril(a,-1);
x=zeros (n,1); % initialize vector x
tol=.5e-6; %
for j=1:k % loop for Jacobigs iteration
    bl=b-u*x;
    for i=1:n
        x(i)=(bl(i)-l(i,:)*x)/d(i,i);
    end
       if norm(x-1,inf)<tol %
           break %
       end %
end % End of Jacobi iteration loop
disp(j); %keeping track of iterations
disp(x(i)); % trying to define ans =


any suggestions would be appreciated so much, thank you!!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
trying to defin... Sean Douglas 18 Aug, 2009 15:59:06
rssFeed for this Thread

Contact us at files@mathworks.com