Attempted to access lambda(160); index out of bounds because numel(lambda)=1.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!