Attempted to access lambda(160); index out of bounds because numel(lambda)=1.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I am using Matlab2008 and I have this problem : "Attempted to access lambda(160); index out of bounds because numel(lambda)=1."
This is my program code:
clear all
n=1000;
a=input('a: ');
b=input('b: ');
Y(1)=input('Y(1)= ');
C(1)=a+b*Y(1);
G=input('G: ');
I=input('I: ');
E(1)=C(1)+I+G;
lambda=input('lambda: ');
delY(2)=lambda(E(1)-Y(1));
%Ys=(a+I+G)/(1-b);
for t=2:n
C(t)=a+b*Y(t);
delY(t+1)=lambda(E(t)-Y(t));
Y(t+1)=lambda(a+I+G)+[1-(lambda(1-b))]*Y(t);
end;
time=1:1:n;
figure
plot(time,Y)
xlabel('t')
ylabel('Y(t)')
Does anyone know what this problem relates to?
Thanks in advance.
0 commentaires
Réponses (1)
Walter Roberson
le 14 Mai 2013
What response is the user expected to give to
lambda=input('lambda: ');
??
Do you understand that lambda(E(1)-Y(1)) means to access the array named "lambda" at the index which has been calculated as E(1) minus Y(1) ?
0 commentaires
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!