- 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.
I will like to know what is the problem with my "iterate" function and how to solve it
1 view (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));
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
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?