Path: news.mathworks.com!not-for-mail
From: "Steven_Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Iterative Procedure Using Vectors
Date: Thu, 25 Apr 2013 14:30:57 -0400
Organization: MathWorks
Lines: 39
Message-ID: <klbsp0$t0m$1@newscl01ah.mathworks.com>
References: <klbqnr$mdk$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: ah-slord.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="UTF-8";
	reply-type=response
Content-Transfer-Encoding: 7bit
X-Trace: newscl01ah.mathworks.com 1366914656 29718 172.28.9.169 (25 Apr 2013 18:30:56 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 25 Apr 2013 18:30:56 +0000 (UTC)
In-Reply-To: <klbqnr$mdk$1@newscl01ah.mathworks.com>
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Xref: news.mathworks.com comp.soft-sys.matlab:794360



"Laura " <laurafilgate17@gmail.com> wrote in message 
news:klbqnr$mdk$1@newscl01ah.mathworks.com...
> I have been told to carry out the following iterative procedure:
> a) Set a vector v to be the vector [1 ; 0]
> b) Find a new vector u = Av (where A is a 2 x 2 real matrix)
> c) Find the magnitude of this new vector u, and call this magnitude c
> d) Divide u by c
> e) Set v to be this unit vector, then repeat steps b) to e) a number of 
> times.
>
> So far I have tried:
> v(1) = [1 ; 0]

You can't fit the two elements of [1; 0] into the one element of v(1). It's 
too big. If you wanted to store that in the first column of v, that would 
work:

v(:, 1) = [1; 0]

> for n = 1:100
>    u(n) = A*v(n+1)

See above plus you'll want to change all your indexing to refer to columns 
of the matrix rather than individual elements.

Also pay close attention to whether you want elementwise or vector division. 
See:

http://www.mathworks.com/help/matlab/ref/rdivide.html
http://www.mathworks.com/help/matlab/ref/mrdivide.html

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com