![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
matlab fzero 命令运行时错误
运用matlab编程求方程的根,程序如下:a=0:10;y=0.17*cos(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.163*sin(5.6*...
运用matlab编程求方程的根,程序如下:
a=0:10;
y=0.17*cos(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.163*sin(5.6*sqrt(a)).*sin(0.47*sqrt(a))...
-0.119*sqrt(a).*sin(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.104*sqrt(a).*cos(5.6*sqrt(a)).*sin(0.47*sqrt(a))...
+(0.06*cos(5.6*sqrt(a)).*sin(0.47*sqrt(a))+0.053*sin(5.6*sqrt(a)).*cos(0.47*sqrt(a)))./sqrt(a);
plot(a,y);
grid on;
a1= fzero ('0.17*cos(5.6*sqrt(a))*cos(0.47*sqrt(a))-0.163*sin(5.6*sqrt(a))*sin(0.47*sqrt(a))-0.119*sqrt(a)*sin(5.6*sqrt(a))*cos(0.47*sqrt(a))-0.104*sqrt(a)*cos(5.6*sqrt(a))*sin(0.47*sqrt(a))+(0.06*cos(5.6*sqrt(a))*sin(0.47*sqrt(a))+0.053*sin(5.6*sqrt(a))*cos(0.47*sqrt(a)))/sqrt(a)',1)
本来不输入最后一个命令时正确的,出来一个曲线,我想求方程=0时在1附近的根,一输入最后一个命令就出错:如图,请高手帮助,谢谢了~~~~~
... 展开
a=0:10;
y=0.17*cos(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.163*sin(5.6*sqrt(a)).*sin(0.47*sqrt(a))...
-0.119*sqrt(a).*sin(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.104*sqrt(a).*cos(5.6*sqrt(a)).*sin(0.47*sqrt(a))...
+(0.06*cos(5.6*sqrt(a)).*sin(0.47*sqrt(a))+0.053*sin(5.6*sqrt(a)).*cos(0.47*sqrt(a)))./sqrt(a);
plot(a,y);
grid on;
a1= fzero ('0.17*cos(5.6*sqrt(a))*cos(0.47*sqrt(a))-0.163*sin(5.6*sqrt(a))*sin(0.47*sqrt(a))-0.119*sqrt(a)*sin(5.6*sqrt(a))*cos(0.47*sqrt(a))-0.104*sqrt(a)*cos(5.6*sqrt(a))*sin(0.47*sqrt(a))+(0.06*cos(5.6*sqrt(a))*sin(0.47*sqrt(a))+0.053*sin(5.6*sqrt(a))*cos(0.47*sqrt(a)))/sqrt(a)',1)
本来不输入最后一个命令时正确的,出来一个曲线,我想求方程=0时在1附近的根,一输入最后一个命令就出错:如图,请高手帮助,谢谢了~~~~~
... 展开
展开全部
你可以使用下面的代码:
a=0:0.1:10;
y=0.17*cos(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.163*sin(5.6*sqrt(a)).*sin(0.47*sqrt(a))...
-0.119*sqrt(a).*sin(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.104*sqrt(a).*cos(5.6*sqrt(a)).*sin(0.47*sqrt(a))...
+(0.06*cos(5.6*sqrt(a)).*sin(0.47*sqrt(a))+0.053*sin(5.6*sqrt(a)).*cos(0.47*sqrt(a)))./sqrt(a);
plot(a,y);
hold on
grid on;
a1= fzero (@(a)0.17*cos(5.6*sqrt(a))*cos(0.47*sqrt(a))-0.163*sin(5.6*sqrt(a))*sin(0.47*sqrt(a))-0.119*sqrt(a)*sin(5.6*sqrt(a))*cos(0.47*sqrt(a))-0.104*sqrt(a)*cos(5.6*sqrt(a))*sin(0.47*sqrt(a))+(0.06*cos(5.6*sqrt(a))*sin(0.47*sqrt(a))+0.053*sin(5.6*sqrt(a))*cos(0.47*sqrt(a)))/sqrt(a),1)
plot([a1],[0],'r*')
或者你可以把你的fzero函数中的a换为x,因为这个函数默认的自变量是x,其他的不行。
祝你学习愉快!
a=0:0.1:10;
y=0.17*cos(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.163*sin(5.6*sqrt(a)).*sin(0.47*sqrt(a))...
-0.119*sqrt(a).*sin(5.6*sqrt(a)).*cos(0.47*sqrt(a))-0.104*sqrt(a).*cos(5.6*sqrt(a)).*sin(0.47*sqrt(a))...
+(0.06*cos(5.6*sqrt(a)).*sin(0.47*sqrt(a))+0.053*sin(5.6*sqrt(a)).*cos(0.47*sqrt(a)))./sqrt(a);
plot(a,y);
hold on
grid on;
a1= fzero (@(a)0.17*cos(5.6*sqrt(a))*cos(0.47*sqrt(a))-0.163*sin(5.6*sqrt(a))*sin(0.47*sqrt(a))-0.119*sqrt(a)*sin(5.6*sqrt(a))*cos(0.47*sqrt(a))-0.104*sqrt(a)*cos(5.6*sqrt(a))*sin(0.47*sqrt(a))+(0.06*cos(5.6*sqrt(a))*sin(0.47*sqrt(a))+0.053*sin(5.6*sqrt(a))*cos(0.47*sqrt(a)))/sqrt(a),1)
plot([a1],[0],'r*')
或者你可以把你的fzero函数中的a换为x,因为这个函数默认的自变量是x,其他的不行。
祝你学习愉快!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询