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

조회 수: 3 (최근 30일)
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

답변 (1개)

Steven Lord
Steven Lord 2023년 5월 19일
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
Cedrick De Block
Cedrick De Block 2023년 5월 19일
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 2023년 5월 19일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Downloads에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by