MATLAB编程问题弹出了这样的问题:Error using / Matrix dimensions must agree.Error in Untitled4 (line 11)C=Q./(2*3.14*u*y1.*z1).*exp(-Y.^2./(2*y1.^2)).*(exp((H)^2/(2*y1.^2))+exp((H)^2./(2*z1.^2)));下面是程序:x=0:3000;y=-500:500;[X,Y

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/21 14:29:35
MATLAB编程问题弹出了这样的问题:Errorusing/Matrixdimensionsmustagree.ErrorinUntitled4(line11)C=Q./(2*3.14*u*y1.*z

MATLAB编程问题弹出了这样的问题:Error using / Matrix dimensions must agree.Error in Untitled4 (line 11)C=Q./(2*3.14*u*y1.*z1).*exp(-Y.^2./(2*y1.^2)).*(exp((H)^2/(2*y1.^2))+exp((H)^2./(2*z1.^2)));下面是程序:x=0:3000;y=-500:500;[X,Y
MATLAB编程问题
弹出了这样的问题:
Error using /
Matrix dimensions must agree.
Error in Untitled4 (line 11)
C=Q./(2*3.14*u*y1.*z1).*exp(-Y.^2./(2*y1.^2)).*(exp((H)^2/(2*y1.^2))+exp((H)^2./(2*z1.^2)));
下面是程序:
x=0:3000;
y=-500:500;
[X,Y]=meshgrid(x,y);
Q=43100*exp(-1.2*10^5*44*X);
a1=0.914370;
a2=1.09356;
y1=0.08*X.^a1;
z1=0.06*X.^a2;
H=81.4517;
u=2.92;
C=Q./(2*3.14*u*y1.*z1).*exp(-Y.^2./(2*y1.^2)).*(exp((H)^2/(2*y1.^2))+exp((H)^2./(2*z1.^2)));
contour(x,y,C);
Colorbar;

MATLAB编程问题弹出了这样的问题:Error using / Matrix dimensions must agree.Error in Untitled4 (line 11)C=Q./(2*3.14*u*y1.*z1).*exp(-Y.^2./(2*y1.^2)).*(exp((H)^2/(2*y1.^2))+exp((H)^2./(2*z1.^2)));下面是程序:x=0:3000;y=-500:500;[X,Y
矩阵维数不一致.问题出现在矩阵C的计算中:
C=Q./(2*3.14*u*y1.*z1).*exp(-Y.^2./(2*y1.^2)).*(exp((H)^2./(2*y1.^2))+exp((H)^2./(2*z1.^2)));
即在exp((H)^2./(2*y1.^2)计算中少了个点,从而点除变成了除,出问题了.
现在运行肯定好了!