Dear All
i am solving a equation after first iteration i got value as infinity, actually i want the value of x(1)to x(20), Lembda(1) to Lembda(2), c(1) to c(20), P(1)to p(20) and a(1) to a(20). when i am running code only i am able to get the value of first iteration. after first iteration x(2) value become inf. here is the code.
M=100;r=0.8;alpha=0.45;beta=0.75;gama=0.1;d=0.004;h=0.4;n=100;c0=1500;nn=10;x = zeros(nn,1);a = zeros(nn,1);p = zeros(nn,1);c = zeros(nn,1);lembda = zeros(nn,1);delT=1;c(1)=1580;x(1)=2;a(1)=310000;p(1)=1635;lembda(1)=150;for t=1:nnq(t)=0.8;xxx=t+1;x(xxx)=x(t)+delT*alpha+beta*log10(a(t))+gama*x(t)*(M-x(t))*exp(-d*p(t))*exp(h*q(t));disp('x(t)');x(xxx)gx=exp(-d*p(t))*exp(h*q(t))*(gama*M-alpha-beta*log10(a(t))-2*gama*x(t));cx=n*q(t)^(x(t)-1)*log10(q(t));gt=(alpha+beta*log10(a(t))+gama*x(t))*(M-x(t))*exp(-d*p(t))*exp(h*q(t));lembda(xxx)=lembda(t)+delT*(r*lembda(t)-gx*(p(t)-c(t)+lembda(t))+cx*gt);disp('lembda(t+1)');lembda(xxx)c(t)=n*q(t)^(x(t)-1)+c0;disp('c(t)');c(t)p(t)=c(t)-lembda(t)+1/d;disp('p(t)');p(t)a(t)=(p(t)-c(t)+lembda(t))*beta*(M-x(t))*exp(-d*p(t))*exp(h*q(t));disp('a(t)');a(t)end
please help me to get my desired result.
Thank You
Best Answer