I am confused about why my variables are different in the workspace and the command window.
here is my screenshot and the L values appears to be 1 in the command window and 86.0104 in the workspace?
and here is my code:
%%solve for V and L
zA = 0.1;zB = 0.9;F = 100;xA= 3.1862e-03;xB= 9.9681e-01;yA= 0.7010;yB= 0.299;tolr = 1e-5;z0 = [1 1]';%initial guess for V and L.
err=1e5*rand(2,1);%initial guess for the error
k = 1; z(:,1) = z0 ;if sum(err)>=tolr L = z0(2,k);%1st iteration values
V =(zA*F-xA*L)/yA; z(1,k+1) = V; L = (zB*F-yB*V)/xB; z(2,k+1) = L; err = abs(z(:,k+1)-z(:,k)); endfprintf('V= %d,L= %d\n',z(1,k),z(2,k));
Best Answer