matlab fzero 命令运行时错误运用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.
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/09 02:55:07
matlab fzero 命令运行时错误运用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.
matlab fzero 命令运行时错误
运用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附近的根,一输入最后一个命令就出错:如图,
...
matlab fzero 命令运行时错误运用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.
你可以使用下面的代码:
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,其他的不行.
祝你学习愉快!