I'd like to solve those problems from under coding using A, B, and C relationships. If equation error can't be fixed, "B(i+1)=B(i)+((h.*q)/(k*T*E))*C(i)" can be used.
a = 0;b = 1;n = 110;k = 8.61733*10^(-5); T = 300 ;q = 1.60218*10^(-19);E = 8.8542*10^(-12)x= linspace(a,b,n);h= x(2)-x(1);A = zeros(size(x));B = zeros(size(x));for i = 0:n-1 A(0)=3; B(0)=1; C(i)=2*x(i)+3; A(i+1)=A(i)-h.*B(i)-(0.5.*h.^2*q.*C(i))./(k*T*E); B(i+1)=B(i)+((h.*q)/(k*T*E))*0.5*(C(i)+C(i+1));%equation error
endplot(transpose(x),A,'.')
Best Answer