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: 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 ]
James

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

Hi,

I am attempting to store a value from a for loop every time the loop executes, but the step size of the loop begins with zero and increments at a non-integer value until it reaches a specific value. I have tried several various approaches, with my most recent approach below.

All I want to do is store all of the values returned by the function "machsolve" into an array.

Any ideas?


N=100; %number of prandtl meyer angle increments

M=2; %design exit mach number
g = 1.4; %specific heat ratio of air

A = sqrt((g+1)/(g-1));
B = atan(sqrt(((g-1)/(g+1))*(M^2-1)));
C = atan(sqrt(M^2-1));

nu = A*B-C; %prandtl meyer function to calculate maximum turn angle

thetaexit = nu;

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

Thanks ,



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.