Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: what is Code algorithm? why it can be made?
Replies: 2   Last Post: May 11, 2012 9:25 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Quynh Tram Nghuyen Thi

Posts: 37
Registered: 4/13/12
what is Code algorithm? why it can be made?
Posted: May 11, 2012 6:32 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.