matlab 积分>> w=linspace(0.3434,2.2196,80);>> t=1:1000;>> for i=1:1000syms xy(i)=int('x.*(-1.61.*sum((0.1276./w.^5.*exp(-0.0018./w.^4).*0.0238).^0.5.*w.^2.*cosh((w.^2./235.2).^0.5.*x)./sinh((w.^2./235.2).^0.5.*24).*(sin(w*t(i)+2*pi*rand()))))',x,0,
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 22:49:39
matlab 积分>> w=linspace(0.3434,2.2196,80);>> t=1:1000;>> for i=1:1000syms xy(i)=int('x.*(-1.61.*sum((0.1276./w.^5.*exp(-0.0018./w.^4).*0.0238).^0.5.*w.^2.*cosh((w.^2./235.2).^0.5.*x)./sinh((w.^2./235.2).^0.5.*24).*(sin(w*t(i)+2*pi*rand()))))',x,0,
matlab 积分
>> w=linspace(0.3434,2.2196,80);
>> t=1:1000;
>> for i=1:1000
syms x
y(i)=int
('x.*(-1.61.*sum((0.1276./w.^5.*exp(-0.0018./w.^4).*0.0238).^0.5.*w.^2.*cosh((w.^2./235.2).^0.5.*x)./sinh((w.^2./235.2).^0.5.*24).*(sin(w*t(i)+2*pi*rand()))))',x,0,24)
end
plot(t,y)
目的是y(i)在[0,24]上对x积分 但怎么输入end后没有“》”了?问问怎么回事,
matlab 积分>> w=linspace(0.3434,2.2196,80);>> t=1:1000;>> for i=1:1000syms xy(i)=int('x.*(-1.61.*sum((0.1276./w.^5.*exp(-0.0018./w.^4).*0.0238).^0.5.*w.^2.*cosh((w.^2./235.2).^0.5.*x)./sinh((w.^2./235.2).^0.5.*24).*(sin(w*t(i)+2*pi*rand()))))',x,0,
1、你把被积分表达式写成字符串,w的值不可能起作用;
2、积分很难求出解析表达式,而既然是计算定积分,就没必要(也没办法)用int,使用数值积分函数quadl为宜.
参考代码:
w=linspace(0.3434,2.2196,80);t=1:1000;
for i=1:1000
syms x
f=x.*(-1.61.*sum((0.1276./w.^5.*exp(-0.0018./w.^4).*0.0238).^0.5.*w.^2.*cosh((w.^2./235.2).^0.5.*x)./sinh((w.^2./235.2).^0.5.*24).*(sin(w*t(i)+2*pi*rand()))));
y(i)=quadl(@(x)subs(f,x),0,24);
end
plot(t,y)
结果: