Index in position 1 is invalid. Array indices must be positive integers or logical values?

why am getting this error?
the error massage is:
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in secondparameterestimation (line 109)
Ppost= (1./((2*pi*sigma.^2)^(N./2))).*exp(-sum(I,2)./(2*sigma.^2));
Here is the main code:
N=12;
sigma=100;
Ymeasurement=[347.6192 349.8622 350.5189 351.6964 352.6208 358.4055 356.9439 358.2743 352.8084 350.9066 347.9320 349.0564];
I=zeros(1000,12);
pi=3.1415926;
for i=1:1000
for k=1:12
I(i,k)=(Ymeasurement(1,k)-(T{i}(k))).^2;
end
end
Ppost= (1./((2*pi*sigma.^2)^(N./2))).*exp(-sum(I,2)./(2*sigma.^2));
Pmax=max(Ppost);
l=Ppost./Pmax;
plot(ri,l,'r.')

4 comentarios

T is the Temperature ,which has been taken from the previous code
Run the following code in your command window and share the result.
which sum
Thank you @Cris LaPierre, the problem has been resolved.Thanks for your efforts.

Iniciar sesión para comentar.

Respuestas (0)

Preguntada:

el 3 de Oct. de 2021

Comentada:

el 3 de Oct. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by