Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Automating an iterative procedure
Posted:
Feb 24, 2013 5:56 AM
|
|
Dear dpb, yes, intermediate values of B0 and B1 have to be stored, I have to see when they converge. Any help would be greatly appreciated! Best, M
dpb <none@non.net> wrote in message <kgbdd4$isu$1@speranza.aioe.org>... > On 2/23/2013 3:01 PM, Milos Milenkovic wrote: > > ...[top posting repaired--please don't: hard conversation follow makes]... > > > dpb <none@non.net> wrote in message <kgb86j$446$1@speranza.aioe.org>... > >> On 2/23/2013 2:04 PM, Milos Milenkovic wrote: > >> ... > >> > K1=[-0.2582 -18.596 0 -0.2582; > >> > -34.737 -1300.188 0 -34.737; > >> ... > >> > for i=1:100 > >> > B1(1)=[0.01 0.02 0.07 0.03; > >> > 0.02 0.05 0.06 0.02; > >> > 0.07 0.09 0.01 0.03; > >> > 0.01 0.03 0.02 0.04]; > >> > >> ... > >> > >> No, but why would you want to duplicate a constant array anyway? > >> Sometimes for matrix operations there's a need/desire to do so, but > >> generally a temporary via repmat() or some other technique would be > >> more reasonable than just holding multiple copies of the same array. > >> > >> B1(1) refers to a single array location whereas the rhs is an array. > >> "Can't put 5-lbs of 'taters in a 1-lb tote" to use the E TN vernacular. > >> > >> Only a cell array element can hold another array. > >> > > ... > > >> B1(1) and B0(1) are given matrices in iteration 1, then for the next 99 > >> iterations I want to calculate updates of these matrices. > > Oh. > > Move the initiation outside the loop then store new values into the > desired location(s) in the array inside the iterative portion (the loop > iow). To do that you don't need to subscript B1 at all other than to > address individual elements therein if required. But, if you can > vectorize the computation of B1 then there's no need for the indexing. > > Are you needing to save all iterations to the bitter end? > > --
|
|
|
|