The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Storing loop values -- non-integer step sizes
Replies: 2   Last Post: Dec 6, 2012 6:17 PM

Advanced Search

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

Posts: 5,929
Registered: 12/7/04
Re: Storing loop values -- non-integer step sizes
Posted: Dec 6, 2012 5:04 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"James " <> wrote in message <k9r2jd$28k$>...
> 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);

Roger Stafford

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.