matlab的inline函数报错Error using inline/feval (line 23)Not enough inputs to inline function我的代码如下:r1 = 60;Bg = 60;Sd = Bg/2;n0 = 1000000000;k = 2*pi/Bg;z = 60;syms xy = inline('900-z^2-x^2+2*z*x*cos(angle(besselh(1,1,2*pi*x/60))-a
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 14:41:12
matlab的inline函数报错Error using inline/feval (line 23)Not enough inputs to inline function我的代码如下:r1 = 60;Bg = 60;Sd = Bg/2;n0 = 1000000000;k = 2*pi/Bg;z = 60;syms xy = inline('900-z^2-x^2+2*z*x*cos(angle(besselh(1,1,2*pi*x/60))-a
matlab的inline函数报错Error using inline/feval (line 23)Not enough inputs to inline function
我的代码如下:
r1 = 60;
Bg = 60;
Sd = Bg/2;
n0 = 1000000000;
k = 2*pi/Bg;
z = 60;
syms x
y = inline('900-z^2-x^2+2*z*x*cos(angle(besselh(1,1,2*pi*x/60))-angle(besselh(1,1,2*pi*z/60)))','x','z');
[r2,f] = fsolve(y,z);
报错:
Error using inline/feval (line 23)
Not enough inputs to inline function.
Error in fsolve (line 241)
fuser = feval(funfcn{3},x,varargin{:});
Error in myrfun (line 12)
[r2,f] = fsolve(y,z);
Caused by:
Failure in initial user-supplied objective function evaluation.FSOLVE cannot continue.
应该是inline用的有问题,因为把inline里面的z都用60这个具体数值替代后,就可以运行了
matlab的inline函数报错Error using inline/feval (line 23)Not enough inputs to inline function我的代码如下:r1 = 60;Bg = 60;Sd = Bg/2;n0 = 1000000000;k = 2*pi/Bg;z = 60;syms xy = inline('900-z^2-x^2+2*z*x*cos(angle(besselh(1,1,2*pi*x/60))-a
1)syms x z;
2)fsolve的写法不对,要定初值,语法要求是 FSOLVE(FUN,X0,OPTIONS)