Matlab 数值积分i=2;q=acos((x.^2-1+x.^2.*i^2)./(2*x.^2.*i)); f=@(x)((x.^2-1).*x.^2.*i*sin(q)-x.^2.*i^2*asin(x.*sin(q))+(x.^2.*i^2-(x.^2-1).^2).*q)./(pi*(x.^2-1).^2)+1;f2=quad(f,1/(i+1),1/(i-1));Error using ==> mtimesInner matrix dimensions must ag
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 00:57:07
Matlab 数值积分i=2;q=acos((x.^2-1+x.^2.*i^2)./(2*x.^2.*i)); f=@(x)((x.^2-1).*x.^2.*i*sin(q)-x.^2.*i^2*asin(x.*sin(q))+(x.^2.*i^2-(x.^2-1).^2).*q)./(pi*(x.^2-1).^2)+1;f2=quad(f,1/(i+1),1/(i-1));Error using ==> mtimesInner matrix dimensions must ag
Matlab 数值积分
i=2;
q=acos((x.^2-1+x.^2.*i^2)./(2*x.^2.*i));
f=@(x)((x.^2-1).*x.^2.*i*sin(q)-x.^2.*i^2*asin(x.*sin(q))+(x.^2.*i^2-(x.^2-1).^2).*q)./(pi*(x.^2-1).^2)+1;
f2=quad(f,1/(i+1),1/(i-1));
Error using ==> mtimes
Inner matrix dimensions must agree.
错在哪呀.
Matlab 数值积分i=2;q=acos((x.^2-1+x.^2.*i^2)./(2*x.^2.*i)); f=@(x)((x.^2-1).*x.^2.*i*sin(q)-x.^2.*i^2*asin(x.*sin(q))+(x.^2.*i^2-(x.^2-1).^2).*q)./(pi*(x.^2-1).^2)+1;f2=quad(f,1/(i+1),1/(i-1));Error using ==> mtimesInner matrix dimensions must ag
matlab不会把q=acos((x.^2-1+x.^2.*i^2)./(2*x.^2.*i)); 代入f的
改为下面的即可
i=2;f=@(x)((x.^2-1).*x.^2.*i.*sin(acos((x.^2-1+x.^2.*i^2)./(2*x.^2.*i)))-x.^2.*i^2.*asin(x.*sin(acos((x.^2-1+x.^2.*i^2)./(2*x.^2.*i))))+(x.^2.*i^2-(x.^2-1).^2).*acos((x.^2-1+x.^2.*i^2)./(2*x.^2.*i)))./(pi*(x.^2-1).^2)+1;
f2=quad(f,1/(i+1),1/(i-1))
f2 =
0.5959