フィルターのクリア

How can I resolve this problem?

1 回表示 (過去 30 日間)
Deepesh Kumar Gupta
Deepesh Kumar Gupta 2022 年 4 月 4 日
why am i getting this error?
Index exceeds the number of array elements. Index must not exceed 30.
Error in Inver_theta_ecc (line 23)
maxvalex= ex(idex);
Here is the code that have written-
clc;
clear all;
r=.011;
q=12;
sigma=5;
FD = csvread("forwardtemp.csv");
ID = csvread("Theta_ecc.csv");
pi=3.1415926;
for i=1:1080
for k=1:68
I(k,i)=(FD(k,1)-ID(k,i)).^2;
end
I;
M=sum(I);
Ppost(i)=exp(-M(i)/(2*q^2))/(2*pi*q^2)^6;
end
Ppostmax= max(Ppost);
O= (Ppost./Ppostmax);
ex=-.009:.001:.02;
[maxvalPpost,idex]=max(Ppost);
maxvalex= ex(idex);
theta=0:10:350;
[maxvalPpost,idtheta]=max(Ppost);
maxvaltheta= theta(idtheta);
sum0=0;
for m=1:30
u(m)= ex(m);
sum1=sum0+u(m);
end
Meanex= sum1/30;
errorMAP_ex= 100*(.017-maxvalex)/(.017)
errorMean_ex=100*(.017-Meanex)/(.017)
for m=1:36
u(m)= theta(m);
sum2=sum0+u(m);
end
Meantheta= sum2/36;
errorMAPtheta= 100*(180-maxvaltheta)/(180)
errorMeantheta=100*(180-Meantheta)/(180)
test=csvread('Theta_ecc.csv');
x=test(:,1);
y=test(:,2);
z=test(:,3);
scatter3(x,y,z)
colormap jet
shading interp;

採用された回答

Torsten
Torsten 2022 年 4 月 4 日
The arrays "Ppost" and "ex" don't have the same number of elements.
This has the effect that "ex" has less elements than the value of the variable "idex".
Output numel(ex) and idex to see what's going wrong.
The same problem might appear for theta(idtheta).
  1 件のコメント
Deepesh Kumar Gupta
Deepesh Kumar Gupta 2022 年 4 月 4 日
@Torsten , thank you . The problem has been resolved.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by