matlab 运行下面的程序出现一些错误,请帮忙看看错误在哪里,谢谢.程序syms x n mn=0;m=1377*10^6;x=0.1:0.01:6;f(x)=(x.*19.1*300*300*pi.*(1-(sin(2*pi.*x))/(2*pi.*x))-n)/((3*x-1.25)*360);plot(x,f(x))运行出错? Subscript indices m
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/30 07:25:01
matlab 运行下面的程序出现一些错误,请帮忙看看错误在哪里,谢谢.程序syms x n mn=0;m=1377*10^6;x=0.1:0.01:6;f(x)=(x.*19.1*300*300*pi.*(1-(sin(2*pi.*x))/(2*pi.*x))-n)/((3*x-1.25)*360);plot(x,f(x))运行出错? Subscript indices m
matlab 运行下面的程序出现一些错误,请帮忙看看错误在哪里,谢谢.
程序
syms x n m
n=0;
m=1377*10^6;
x=0.1:0.01:6;
f(x)=(x.*19.1*300*300*pi.*(1-(sin(2*pi.*x))/(2*pi.*x))-n)/((3*x-1.25)*360);
plot(x,f(x))
运行出错
? Subscript indices must either be real positive integers or logicals.
程序
function h = myfun(x)
syms x n m f h g
h=f-g;
n=0;
m=1377*10^6;
f=(x*19.1*300*300*pi*(1-(sin(2*pi*x))/(2*pi*x))-n)/((3*x-1.25)*360);
g=pi*((2/3)*19.1*300*300*300*(sin(pi*x))^3-m)/(360*255*(sin(pi*x)+sin(pi*(1.25-2*x))));
保存为名为myfun的M文件
后来在命令窗口调用
x = fzero(@myfun,1)
出错
? Function 'isfinite' is not defined for values of class 'sym'.
Error in ==> isfinite at 19
[varargout{1:nargout}] = builtin('isfinite', varargin{:});
Error in ==> fzero at 309
elseif ~isfinite(fx) || ~isreal(fx)
matlab 运行下面的程序出现一些错误,请帮忙看看错误在哪里,谢谢.程序syms x n mn=0;m=1377*10^6;x=0.1:0.01:6;f(x)=(x.*19.1*300*300*pi.*(1-(sin(2*pi.*x))/(2*pi.*x))-n)/((3*x-1.25)*360);plot(x,f(x))运行出错? Subscript indices m
syms x n m
n=0;
m=1377*10^6;
x=0.1:0.01:6;
f=(x.*19.1*300*300*pi.*(1-(sin(2*pi.*x))/(2*pi.*x))-n)/((3*x-1.25)*360);
plot(x,f)
齐活