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

我定义的两个循环量都是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

 Réponse acceptée

segxhjg
segxhjg le 19 Mai 2023

0 votes

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

Plus de réponses (0)

Catégories

En savoir plus sur Simulink dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!