Path: news.mathworks.com!not-for-mail
From: "James " <jpk77@msstate.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Storing loop values -- non-integer step sizes
Date: Thu, 6 Dec 2012 23:17:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <k9r91m$p14$1@newscl01ah.mathworks.com>
References: <k9r2jd$28k$1@newscl01ah.mathworks.com> <k9r4op$agc$1@newscl01ah.mathworks.com>
Reply-To: "James " <jpk77@msstate.edu>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1354835830 25636 172.30.248.46 (6 Dec 2012 23:17:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 6 Dec 2012 23:17:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3578582
Xref: news.mathworks.com comp.soft-sys.matlab:784355

"Roger Stafford" wrote in message <k9r4op$agc$1@newscl01ah.mathworks.com>...
> "James " <jpk77@msstate.edu> wrote in message <k9r2jd$28k$1@newscl01ah.mathworks.com>...
> > i = thetaexit/N; %incremental step size
> > for dnu=0:i:thetaexit
> >     MM = machsolve(dnu, g); %call function that returns MM
> >     M(:,1) = MM %latest attempt at storing the returned values
> > end
> - - - - - - - - -
>   As it is, your for-loop is not generating an index that can be used to store your values in 'M'.  Do something like this instead:
> 
>  dnu = linspace(0,thetaexit,N+1);
>  for ix = 1:N+1
>   M(ix) = machsolve(dnu(ix),g);
>  end
> 
> Roger Stafford

Perfect!

Thanks Roger!