Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Undefined function or method 'E' for input arguments of type 'double'. And how to do summation of functions

1 visualización (últimos 30 días)
I want to perform the following task on MATLAB: d(m)=d0(m)+∑_(n=1)^48▒〖Eo(m,n).(do(i).[p(n)-p0+A]/p0)〗 where d0, p0, A are known and p(n) and Eo(m,n) value depend on some conditions. Here is my code:
p0=25.44;
A=p0;
m=1:48;
i=m/2;
n=1:48;
j=n/2;
d0(m)=[0.798,0.742,0.82,0.819,0.962,0.854,0.792,0.825,0.782,0.783,0.722,0.775,0.954,0.736,0.807,0.926,1.18,0.917,1.37,3.279,1.453,2.02,1.245,1.518,2.561,2.048,1.208,2.066,1.756,1.486,0.987,1.192,1.46,1.313,0.936,0.931,1.004,0.901,1.202,1.863,4.04,2.268,1.095,0.983,1.79,1.378,0.907,0.857];
if(i>=0&i<=9&j>=0&j<=9)|(i>9&i<=19&j>9&j<=19)|(i>19&i<=24&j>19&j<=24)
E(m,n)=-0.1;
elseif (i>=0&i<=9&j>19&j<=24)|(i>19&i<=24&j>=0&j<=9)
E(m,n)=0.012
elseif (i>=0&i<=9&j>9&j<=19)|(i>9&i<=19&j>=0&j<=9)
E(m,n)=0.01;
elseif (i>9&i<=19&j>19&j<=24)|(i>19&i<=24&j>9&j<=19)
E (m,n)=0.016;
end
if(i>=0&i<=9)
p(n)=15;
elseif i>9&i<=19
p(n)=25;
else
p(n)=30;
end
for n=1:48
B=(E(m,n).*(d0(m)*(p(n)-p+A)/p0));
S=sum(B(:));
end
d(m)=sum+d0(m);
plot(i, d0(m),i, d(m));
axis([0.5 24 0 5])
d(m)
It keeps showing the error: Undefined function or method 'E' for input arguments of type 'double'.
What do I do to rectify it?
I want to basically find the values of d(m) for each value of d0(m) using the above equation. Do you have another code for it?

Respuestas (1)

David Young
David Young el 16 de Feb. de 2014
Editada: David Young el 19 de Feb. de 2014
The value of i is the vector (1:48)/2. That means that the four tests on the value of i don't make sense - they all return false, and so E is never given a value.
It looks like you might mean to put these tests inside a loop, so that i and j have scalar values. Then you probably need to set E(i,j) to a value rather than E(m,n). Can you try writing some much simpler code to solve a similar problem, so that you understand how it works, before trying to write the code for this problem?

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by