ROOTS 的输入不能包含 NaN 或 Inf。

你好,我是用matlab function实现大致如下的功能代码,运行后报错:ROOTS 的输入不能包含 NaN 或 Inf。请问有没有什么解决方法,谢谢!
function [Pa1,Pa2]=Blend(pa)
F=AeroFun;
n=pa.m2/pa.m1;
Cp1=pa.gamma1*pa.R1/(pa.gamma1-1);
Cp2=pa.gamma2*pa.R2/(pa.gamma2-1);
c=Cp2/Cp1;
theta=pa.T02/pa.T01;
m3=pa.m2+pa.m1;
Cp3=(Cp1+n*Cp2)/(1+n);
T03=(1+n*c*theta)*pa.T01/(1+n*c);
R3=(pa.R1+n*pa.R2)/(1+n);
a01=(pa.gamma2/pa.gamma1)+n*c;
gamma3=pa.gamma2*(1+n*c)/a01;
P01_ratio=F.Pi(pa.lamda2,pa.gamma2)/F.Pi(pa.lamda1,pa.gamma1);
a02=F.C(pa.R2,pa.gamma2)*F.q(pa.lamda2,pa.gamma2);
a03=F.C(pa.R1,pa.gamma1)*P01_ratio*F.q(pa.lamda1,pa.gamma1);
a04=a02/(a03*(theta^0.5));
A_ratio=a04/(n+a04);
a05=((pa.gamma1+1)*pa.R1/(2*pa.gamma1))^0.5;
a06=((pa.gamma2+1)*pa.R2/(2*pa.gamma2))^0.5;
a07=((gamma3+1)*R3/(2*gamma3))^0.5;
a08=n*theta^0.5;
a09=(1+n)*((1+n*c*theta)/(1+n*c))^0.5;
a10=(a05*F.Z(pa.lamda1)+a06*a08*F.Z(pa.lamda2))/(a07*a09);
a11=[1 -a10 1];
lamda_root=roots(a11);

 Respuesta aceptada

Ayush
Ayush el 31 de Mayo de 2023

0 votos

此邮件使用英语,旨在为您提供最快速的答复。如果您希望得到中文回复,请告诉我
们。我们同事会为您翻译此邮件。
You can use any (isnan (a11)) or (any (isinf (a11)) to make sure there are no inf or nan values in your array.
Kindly read about them here

1 comentario

艳荣
艳荣 el 25 de Sept. de 2023
I've solved this issue, thanks anyway!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2022b

Preguntada:

el 17 de Mayo de 2023

Comentada:

el 25 de Sept. de 2023

Community Treasure Hunt

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

Start Hunting!