Clear Filters
Clear Filters

I will like to know what is the problem with my "iterate" function and how to solve it

2 views (last 30 days)
My script is perfectly working except at the line where it suppose to iterate, matlab does not recognize the iterate function can you help me please?
% Atm conditions
R = 287.058;
gamma = 1.4;
Cp = R*gamma/(gamma-1);
T0 = 288.15;
p0 = 101325;
a0 = 340.29;
% Diffuser inlet
RR = .92;
Mach = .75;
ma = convmass(165,'lbm','kg');
Ta = T0*(1 + Mach*Mach*(gamma - 1)/2);
pa = p0*(1 + (gamma-1)*Mach*Mach/2)^(gamma/(gamma-1));
%% Compressor
piC = 15;
effSC = .88;
% Inlet conditions
T1 = Ta;
p1 = pa*RR;
% Find Cp & gamma with iteration
Tfun = @(gamma,Cp) (T1 + T1*(1+(piC^((gamma-1)/gamma)-1)/effSC))/2;
[CpC,gammaC] = iterate(Cp,5,Tfun);
% Outlet conditions
T2 = 2*Tfun(gammaC,CpC) - T1;
p2 = p1*piC

Answers (1)

Steven Lord
Steven Lord on 19 May 2023
A search for functions named iterate on the MathWorks website found only two hits on the first couple pages of results. The first is a function designed to accept an object from SimEvents as its first input and your Cp variable is not one of those objects. The second is a function from System Composer that again accepts an object as its first input and your Cp variable is not one of those objects either.
Did you write or download the iterate function? What specifically happens when you try to call the iterate function?
  • Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
  • Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
  • Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support so we can investigate.
  2 Comments
Cedrick De Block
Cedrick De Block on 19 May 2023
Thank you for your reply, I obtain this error message:
Unrecognized function or variable 'iterate'.
Error in turbojetNotionTP (line 30)
[CpC,gammaC] = iterate(Cp,0,Tfun);
Steven Lord
Steven Lord on 19 May 2023
There's no iterate function that accepts a numeric array as the first input in MATLAB as far as I'm aware. So either you need to download it from some third party, you need to write it, or you need to find a function that performs the operation you want your iterate function to perform and use it instead.
You haven't told us what you expect that iterate function to do or where it comes from. Without that information I'm not sure what help we can provide.

Sign in to comment.

Categories

Find more on Downloads in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!