Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: loop funtion
Replies: 2   Last Post: Jul 25, 2013 9:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Tyson

Posts: 1
Registered: 7/25/13
loop funtion
Posted: Jul 25, 2013 6:17 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I've been posed the following:
Given a 6x6 real matrix, A, and a column vector, v use MATLAB to calculate,
a) A*v
b) ||A*v||
c) u=(A*v)/(||A*v||)
d) reassign v to equal u
e) repeat steps (a) through (d) a total of fifteen times.

This is what I've got so far but it doesn't seem to work,

A = [6 1 1 1 1 1;1 7 0 1 1 1;1 0 8 1 1 1;1 1 1 9 1 1;1 1 1 1 10 1;1 1 1 1 1 1]
v(1) = [1; 0; 0; 0; 0; 0]
for n = 1:15
A*v(n)
norm(A*v(n))
u = (A*v(n))/(norm(A*v(n)))
clear v(n)
v(n) = u
clear u
end

MATLAB tells me "In an assignment A(I) = B, the number of elements in B and I must be the same."


Date Subject Author
7/25/13
Read loop funtion
Tyson
7/25/13
Read Re: loop funtion
Nasser Abbasi
7/25/13
Read Re: loop funtion
Steven Lord

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.