matlab求解积分并画图的问题.clear all syms xM=2;fx=exp(-x*x/2)/sqrt(2*pi);sn=-20:1:100;Q=int(fx,x,sn,inf);P=2*(M-1)*Q/M;plot(sn,P);运行之后出现 Error using ==> plotConversion to double from sym is not possible.Error in ==> Untitled at

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/19 11:20:36
matlab求解积分并画图的问题.clear all syms xM=2;fx=exp(-x*x/2)/sqrt(2*pi);sn=-20:1:100;Q=int(fx,x,sn,inf);P=2*(M-1)*Q/M;plot(sn,P);运行之后出现 Error using ==> plotConversion to double from sym is not possible.Error in ==> Untitled at
xMo0ǿ &RsvD*}0B58YVNVVk尗il]e89+q: &uq>XKd.54bjNxi~c9=dǻѧm/5h nԺ uז2nU 8D*lCV1B/s9 Dv TuXHIL^NUjk]VëNNX{8-l a -;ذ Y[USujd`[ܑM*H?D ^Y:n/"ocA1 aHE(+6 !-PpZRuڟ!Sy| ؗK:&yux z% ]/g't0 Ѡ`;S Z܈Y6_;o7KslOgϋ۳.̮K 󾎩3ݱt큕/.uNs @WEڔSsMujwMlk/6

matlab求解积分并画图的问题.clear all syms xM=2;fx=exp(-x*x/2)/sqrt(2*pi);sn=-20:1:100;Q=int(fx,x,sn,inf);P=2*(M-1)*Q/M;plot(sn,P);运行之后出现 Error using ==> plotConversion to double from sym is not possible.Error in ==> Untitled at
matlab求解积分并画图的问题.
clear all
syms x
M=2;
fx=exp(-x*x/2)/sqrt(2*pi);
sn=-20:1:100;
Q=int(fx,x,sn,inf);
P=2*(M-1)*Q/M;
plot(sn,P);
运行之后出现
Error using ==> plot
Conversion to double from sym is not possible.
Error in ==> Untitled at 8
plot(sn,P);

matlab求解积分并画图的问题.clear all syms xM=2;fx=exp(-x*x/2)/sqrt(2*pi);sn=-20:1:100;Q=int(fx,x,sn,inf);P=2*(M-1)*Q/M;plot(sn,P);运行之后出现 Error using ==> plotConversion to double from sym is not possible.Error in ==> Untitled at
提示你从符号变量变到双精度数值出现错误.还有你注意有些地方需要用到点乘或点除.给你一个可以运行的程序:
clear all;
syms x;
M=2;
fx=exp(-x*x/2)/sqrt(2*pi);
sn=-20:1:100;
t=length(sn);
Q0=zeros(length(sn));
Q=Q0(1:length(sn));
for k=1:t
Q(k)=eval(int(fx,x,sn(k),inf));
end
P=2*(M-1)*Q/M;
plot(sn,P);