Matlab中Inner matrix dimensions must agree是怎么回事?h=[200,600,600,600,600];H=[51000 51000 71400 128000 370000];R=6400;a=(h+H+2*R)/2;c=(H-h)/2;b=sqrt(a*a-c*c);t=(0:.1:2)*pi;x=a*cos(t);y=b*sin(t);plot(x,y,'-r')显示第六行Inner matrix dimens
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 05:44:22
Matlab中Inner matrix dimensions must agree是怎么回事?h=[200,600,600,600,600];H=[51000 51000 71400 128000 370000];R=6400;a=(h+H+2*R)/2;c=(H-h)/2;b=sqrt(a*a-c*c);t=(0:.1:2)*pi;x=a*cos(t);y=b*sin(t);plot(x,y,'-r')显示第六行Inner matrix dimens
Matlab中Inner matrix dimensions must agree是怎么回事?
h=[200,600,600,600,600];
H=[51000 51000 71400 128000 370000];
R=6400;
a=(h+H+2*R)/2;
c=(H-h)/2;
b=sqrt(a*a-c*c);
t=(0:.1:2)*pi;
x=a*cos(t);
y=b*sin(t);
plot(x,y,'-r')显示第六行Inner matrix dimensions must agree.是怎么回事啊?
Matlab中Inner matrix dimensions must agree是怎么回事?h=[200,600,600,600,600];H=[51000 51000 71400 128000 370000];R=6400;a=(h+H+2*R)/2;c=(H-h)/2;b=sqrt(a*a-c*c);t=(0:.1:2)*pi;x=a*cos(t);y=b*sin(t);plot(x,y,'-r')显示第六行Inner matrix dimens
Matlab中默认的变量是矩阵,也就是说,h,H都默认为矩阵,在进行乘法运算时 都必须符合乘法运算规则,左矩阵的行数要等于右矩阵的列数 要想使其能运行出结果,把矩阵转置运算符是单引号“‘”
如下是正确程序
h=[200,600,600,600,600];
H=[51000 51000 71400 128000 370000];
R=6400;
a=(h+H+2*R)/2;
c=(H-h)/2;
b=sqrt(a*a'-c*c');
t=(0:.1:2)*pi;
x=a'*cos(t);
y=b'*sin(t)';
plot(x,y,'-r')