Matlab问题求大神帮忙Attempted to access Xs(-17.23); index must be a
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/23 11:13:30
Matlab问题求大神帮忙Attempted to access Xs(-17.23); index must be a positive integer or logical.
clear;clc;
format long
% 定义参数
V1=2330*1000;
V2=3240*1000;
X0=2.73;
Z0=17.23;
Xs=50;
Zs=50;
Zb=0;
% Ferrari's Method
B=(V2*V2)/(V1*V1);
P4=B-1;
P3=2*X0-2*B*X0+2*Xs-2*B*Xs;
P2=B*X0*X0-X0*X0-4*X0*Xs+4*B*X0*Xs-Xs*Xs+B*Xs*Xs-(-Z0+Zb)*(-Z0+Zb)+B*(-Zb+Zs)*(-Zb+Zs);
P1=2*X0*X0*Xs-2*B*X0*X0*Xs+2*X0*Xs*Xs-2*B*X0*Xs*Xs+2*Xs(-Z0+Zb)*(-Z0+Zb)-2*B*X0(-Zb+Zs)*(-Zb+Zs);
P0=-X0*X0*Xs*Xs+B*X0*X0*Xs*Xs-Xs*Xs*(-Z0+Zb)*(-Z0+Zb)+B*X0*X0*(-Zb+Zs)*(-Zb+Zs);
P=[P4 P3 P2 P1 P0];
Xb=roots(P);
clear;clc;
format long
% 定义参数
V1=2330*1000;
V2=3240*1000;
X0=2.73;
Z0=17.23;
Xs=50;
Zs=50;
Zb=0;
% Ferrari's Method
B=(V2*V2)/(V1*V1);
P4=B-1;
P3=2*X0-2*B*X0+2*Xs-2*B*Xs;
P2=B*X0*X0-X0*X0-4*X0*Xs+4*B*X0*Xs-Xs*Xs+B*Xs*Xs-(-Z0+Zb)*(-Z0+Zb)+B*(-Zb+Zs)*(-Zb+Zs);
P1=2*X0*X0*Xs-2*B*X0*X0*Xs+2*X0*Xs*Xs-2*B*X0*Xs*Xs+2*Xs(-Z0+Zb)*(-Z0+Zb)-2*B*X0(-Zb+Zs)*(-Zb+Zs);
P0=-X0*X0*Xs*Xs+B*X0*X0*Xs*Xs-Xs*Xs*(-Z0+Zb)*(-Z0+Zb)+B*X0*X0*(-Zb+Zs)*(-Zb+Zs);
P=[P4 P3 P2 P1 P0];
Xb=roots(P);
错误提醒的意思是Xs(-17.23)这个下标不是正整数,matlab里数组的索引只能是正整数哦.
Matlab问题求大神帮忙Attempted to access Xs(-17.23); index must be a
matlab运行出现问题,Attempted to access e(1,0); index must be a pos
Matlab 报错为Attempted to access f(64.4); index must be a posit
MATLAB运行时:Attempted to access (1,0); index must be a positiv
matlab问题 Attempted to access w(1001); index out of bounds be
在MATLAB中,提示Attempted to access th(2,1); index out of bounds
Matlab新手,Attempted to access X(2); index out of bounds becau
matlab Attempted to access x(2); index out of bounds because
matlab中出现 Attempted to access X(1); index out of bounds beca
运行Matlab时出现错误?Attempted to access rxd(500); index out of bou
Attempted to access a(:,2); index out of bounds because size
不知道为什么报这样的错:Attempted to access e(10,:); index out of bounds