为什么索引会超出数组元素的数目?,

我定义的两个循环量都是1:38,可是提示我超了,我点开生成的矩阵发现列数变成了42,应该是38列啊
for i = 1:38
X = target_points(i, 1);
Y = target_points(i, 2);
Z = target_points(i, 3);
for q = 1:38
fun_Dq_enhance = @(Phi) (10^(-7)).*(1./(R_enhance(i)).^3.*q.*c.*cos(2*Phi).*sin(Phi).*(Y-Rhom.*sin(Phi))-q.*c.*cos(2*Phi).*cos(Phi).*(X-Rhom.*cos(Phi)));
fun_Dq_shim = @(p,Phi) (10^(-7)).*(p./(R_shim(i)).^3).*((((2./p).*sin(q.*c.*(p-Rho0)).*sin(2.*Phi).*cos(Phi)-q.*c.*cos(q.*c.*(p-Rho0)).*cos(2.*Phi).*sin(Phi)).*(Y-p.*sin(Phi))...
-((2./p).*sin(q.*c.*(p-Rho0)).*(sin(2.*Phi)).*sin(Phi)+q.*c.*cos(q.*c.*(p-Rho0)).*(cos(2.*Phi)).*cos(2.*Phi).*cos(Phi)).*(X-p.*cos(Phi))));
Dq_shim(i,q) = integral2(fun_Dq_shim, Rho0, Rhom, 0, 2*pi);
Dq_enhance(i,q) = integral(fun_Dq_enhance, 0, 2*pi);
end
DQ(i,:) = Dq_shim(i,:) + Dq_enhance(i,:);
end

 채택된 답변

segxhjg
segxhjg 2023년 5월 19일

0 개 추천

仅供参考,39到42列没有看到有元素存在呀,请上传完整代码,运行到报错处

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

태그

질문:

2023년 5월 19일

답변:

2023년 5월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!