|
|
what is Code algorithm? why it can be made?
Posted:
May 11, 2012 6:32 AM
|
|
hello alll, iam going in sticked with no solutions to understand this algorithm. what com they comes with D, D2R,DR? why they can be made?? what helped user make the code? yes, iam sending all the code as following:
cnhbfunction [R,DR,D2R]=fdm(a,b,f,dx,n,x0,xn) A=zeros(n-1); B=zeros(n-1,1); R=zeros(n+1,1); DR=zeros(n+1,1); D2R=zeros(n+1,1); R(1)=x0; R(n+1)=xn; for i=1:n-1 if i==1 A(i,i)=2-b*dx^2/a; A(i,i+1)=-1; B(i)=-f(i+1)*dx^2/a+R(1); elseif i==n-1 A(i,i-1)=-1; A(i,i)=2-b*dx^2/a; B(i)=-f(i+1)*dx^2/a+R(n+1); else A(i,i-1)=-1; A(i,i)=2-b*dx^2/a; A(i,i+1)=-1; B(i)=-f(i+1)*dx^2/a; ends end R(2:n)=inv(A)*B; D2R=(f-b.*R)./a; DR(1)=(R(2)-R(1)-D2R(1)*dx^2/2)/dx; DR(n+1)=(R(n+1)-R(n)+D2R(n+1)*dx^2/2)/dx; DR(2:n)=(R(3:n+1)-R(1:n-1))/(2*dx);
IAM GOING LOST IN THE WORLD OF ALGORITHMS OF QUESTIONS WHY. I REALLY DONT UNDERSTAND WHY CODE IS MADE WELL. THEN WHAT HELP USER MAKE THESE CODE? iam really in crisis. please, give me any supporting ideas.
|
|