我的程序是这样的s=0+eps:0.01:1000; %s从0变到1000y=vectorize('(-.115*((cos(.943e-2*s^(1/2))-11.6*s^(1/2)*sin(.943e-2*s^(1/2)))*cos(1.36*s^(1/2))+40.4*(-.892e-4*sin(.943e-2*s^(1/2))/s^(1/2)-.104e-2*cos(.943e-2*s^(1/2)))*s^(1/2)*sin(1.36*s^(1
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 08:46:17
我的程序是这样的s=0+eps:0.01:1000; %s从0变到1000y=vectorize('(-.115*((cos(.943e-2*s^(1/2))-11.6*s^(1/2)*sin(.943e-2*s^(1/2)))*cos(1.36*s^(1/2))+40.4*(-.892e-4*sin(.943e-2*s^(1/2))/s^(1/2)-.104e-2*cos(.943e-2*s^(1/2)))*s^(1/2)*sin(1.36*s^(1
我的程序是这样的
s=0+eps:0.01:1000; %s从0变到1000
y=vectorize('(-.115*((cos(.943e-2*s^(1/2))-11.6*s^(1/2)*sin(.943e-2*s^(1/2)))*cos(1.36*s^(1/2))+40.4*(-.892e-4*sin(.943e-2*s^(1/2))/s^(1/2)-.104e-2*cos(.943e-2*s^(1/2)))*s^(1/2)*sin(1.36*s^(1/2)))*cos(.379e-1*s^(1/2))-.115*(261.*(-.323e-1*cos(.943e-2*s^(1/2))+.374*s^(1/2)*sin(.943e-2*s^(1/2)))*sin(1.36*s^(1/2))/s^(1/2)+6.45*(-.469e-2*sin(.943e-2*s^(1/2))/s^(1/2)-.546e-1*cos(.943e-2*s^(1/2)))*cos(1.36*s^(1/2)))*s^(1/2)*sin(.379e-1*s^(1/2)))*cos(.121*s^(1/2))') %将所有乘号和除号改成点乘和点除
plot(s,y);
grid on
可是却出错
Error using ==> plot
Error in color/linetype argument
Error in ==> gaidiancheng at 3
plot(s,y); 说我什么画的什么有错,不怎么懂,若是不自己手改成点乘和点除的话好像不会出现这个错误,请高手指教,
我的程序是这样的s=0+eps:0.01:1000; %s从0变到1000y=vectorize('(-.115*((cos(.943e-2*s^(1/2))-11.6*s^(1/2)*sin(.943e-2*s^(1/2)))*cos(1.36*s^(1/2))+40.4*(-.892e-4*sin(.943e-2*s^(1/2))/s^(1/2)-.104e-2*cos(.943e-2*s^(1/2)))*s^(1/2)*sin(1.36*s^(1
你的y在vectorize后会变成一个符号变量,故plot报错,而不用vectorize,y就是直接计算后面表达式的数值,因此不会出现这个问题.
在plot(s,y);前加上y=eval(y);将y计算成数值再画图就行了.eval(y),相当于将所有乘号和除号改成点乘和点除后的表达式输入到matlab命令窗口中,再执行一遍