Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误x=0:1:12;a=sqrt(10.08+0.5*sqrt(406.43+31.7*x.^2));b=sqrt(-10.08+0.5*sqrt(406.43+31.7*x.^2));c=1./(2*cos(0.115*sqrt(5.63i*x+20.16))); y=0;f=499800*(abs(c)).^2*x*(e
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/19 05:22:29
![Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误x=0:1:12;a=sqrt(10.08+0.5*sqrt(406.43+31.7*x.^2));b=sqrt(-10.08+0.5*sqrt(406.43+31.7*x.^2));c=1./(2*cos(0.115*sqrt(5.63i*x+20.16))); y=0;f=499800*(abs(c)).^2*x*(e](/uploads/image/z/9487063-55-3.jpg?t=Error+using+%3D%3D%3E+mtimes+Inner+matrix+dimensions+must+agree+%E7%94%A8matlab%E6%B1%82%E8%A7%A3%E6%97%B6%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AFx%3D0%3A1%3A12%3Ba%3Dsqrt%2810.08%2B0.5%2Asqrt%28406.43%2B31.7%2Ax.%5E2%29%29%3Bb%3Dsqrt%28-10.08%2B0.5%2Asqrt%28406.43%2B31.7%2Ax.%5E2%29%29%3Bc%3D1.%2F%282%2Acos%280.115%2Asqrt%285.63i%2Ax%2B20.16%29%29%29%3B+y%3D0%3Bf%3D499800%2A%28abs%28c%29%29.%5E2%2Ax%2A%28e)
Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误x=0:1:12;a=sqrt(10.08+0.5*sqrt(406.43+31.7*x.^2));b=sqrt(-10.08+0.5*sqrt(406.43+31.7*x.^2));c=1./(2*cos(0.115*sqrt(5.63i*x+20.16))); y=0;f=499800*(abs(c)).^2*x*(e
Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误
x=0:1:12;
a=sqrt(10.08+0.5*sqrt(406.43+31.7*x.^2));
b=sqrt(-10.08+0.5*sqrt(406.43+31.7*x.^2));
c=1./(2*cos(0.115*sqrt(5.63i*x+20.16)));
y=0;
f=499800*(abs(c)).^2*x*(exp(-2*y*a)+exp(2*y*a)+2*cos(2*y*b));
plot(x,f)
Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> dianjiao at 6
f=499800*(abs(c)).^2*x*(exp(-2*y*a)+exp(2*y*a)+2*cos(2*y*b));
Error using ==> mtimes Inner matrix dimensions must agree 用matlab求解时出现错误x=0:1:12;a=sqrt(10.08+0.5*sqrt(406.43+31.7*x.^2));b=sqrt(-10.08+0.5*sqrt(406.43+31.7*x.^2));c=1./(2*cos(0.115*sqrt(5.63i*x+20.16))); y=0;f=499800*(abs(c)).^2*x*(e
注意,向量的话,这个根据你的需要应该改成点乘
clear;
clc;
x=0:1:12;
a=sqrt(10.08+0.5*sqrt(406.43+31.7*x.^2));
b=sqrt(-10.08+0.5*sqrt(406.43+31.7*x.^2));
c=1./(2*cos(0.115*sqrt(5.63i*x+20.16)));
y=0;
f=499800*(abs(c)).^2.*x.*(exp(-2*y*a)+exp(2*y*a)+2*cos(2*y*b)); %%%注意这行的修改
plot(x,f)
或者干脆就用循环
clear;
clc;
x=0:1:12;
for ii = 1:length(x)
a=sqrt(10.08+0.5*sqrt(406.43+31.7*x(ii)^2));
b=sqrt(-10.08+0.5*sqrt(406.43+31.7*x(ii)^2));
c=1./(2*cos(0.115*sqrt(5.63i*x(ii)+20.16)));
y=0;
f(ii)=499800*(abs(c))^2*x(ii)*(exp(-2*y*a)+exp(2*y*a)+2*cos(2*y*b));
end
plot(x,f)