马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
小弟一初学者,在用fzero求解方程时遇到这样的问题,请高人指点啊!方程如下:
function qr
clear;format long;
tic
global R T P A B C D E F G H I J;
P=8;
T=483;
R=0.082057;
x0=10;
A=10;
B=2;
C=3;
D=4;
E=5;
F=6;
G=7;
H=8;
I=5;
J=2;
den1=fzero(@fun,x0);
t1=toc
disp(den1);
function f=fun(x)
global R T P A B C D E F G H I J;
f=P*T^4-x*R*T^5-(B*x*T^5-A*T^4-C*T^2+D*T-E)*x^2-(H*R*T^5-G*T^4-J*T^3)*x^3-I*(G+J*T^3)*x^6-C*x^3*T^2*(1+F*x^2)*exp(-F*x^2);
程序报错:
??? Error using ==> fzero
Too many input arguments.
Error in ==> qr at 19
den1=fzero(@fun,x0);
于是我又把A B C D E F G H I J设为fzero的传递参数,如下:
function qr
clear;format long;
tic
global R T P;
P=8;
T=483;
R=0.082057;
x0=10;
A=10;
B=2;
C=3;
D=4;
E=5;
F=6;
G=7;
H=8;
I=5;
J=2;
den1=fzero(@fun,x0,[],A,B,C,D,E,F,G,H,I,J);
t1=toc
disp(den1);
function f=fun(x,A,B,C,D,E,F,G,H,I,J)
global R T P;
f=P*T^4-x*R*T^5-(B*x*T^5-A*T^4-C*T^2+D*T-E)*x^2-(H*R*T^5-G*T^4-J*T^3)*x^3-I*(G+J*T^3)*x^6-C*x^3*T^2*(1+F*x^2)*exp(-F*x^2);
??? Error using ==> fzero
Too many input arguments.
Error in ==> qr at 19
den1=fzero(@fun,x0,[],A,B,C,D,E,F,G,H,I,J);
运行后还是报错,而且错误似乎没变,百思不得其解啊,请高人指点啊 |