⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 findiff.m

📁 关于数值计算的matlab程序代码,包含了很多的实用的算法.程序全部可以直接用的,有详细的英文注释.
💻 M
字号:
function F=findiff(p,q,r,a,b,alpha,beta,N)%Input - p, q, and r are the coefficient functions of (1)%        input as strings; 'p',  'q', 'r'%      - a and b are the left and right endpoints%      - alpha =x(a) and beta=x(b)%      - N is the number of steps%Output - F=[T' X']:wherer T' is the 1xN vector of abscissas and%         X' is the 1xN vector of ordinates.%  NUMERICAL METHODS: Matlab Programs% (c) 2004 by John H. Mathews and Kurtis D. Fink%  Complementary Software to accompany the textbook:%  NUMERICAL METHODS: Using Matlab, Fourth Edition%  ISBN: 0-13-065248-2%  Prentice-Hall Pub. Inc.%  One Lake Street%  Upper Saddle River, NJ 07458%Initialize vectors and hT=zeros(1,N+1);X=zeros(1,N-1);Va=zeros(1,N-2);Vb=zeros(1,N-1);Vc=zeros(1,N-2);Vd=zeros(1,N-1);h=(b-a)/N;%Calculate the constant vector B in AX=BVt=a+h:h:a+h*(N-1);Vb=-h^2*feval(r,Vt);Vb(1)=Vb(1)+(1+h/2*feval(p,Vt(1)))*alpha;Vb(N-1)=Vb(N-1)+(1-h/2*feval(p,Vt(N-1)))*beta;%Calculate the main diagonal of A in AX=BVd=2+h^2*feval(q,Vt);%Calculate the super diagonal of A in AX=BVta=Vt(1,2:N-1);Va=-1-h/2*feval(p,Vta);%Calculate the sub diagonal of A in AX=BVtc=Vt(1,1:N-2);Vc=-1+h/2*feval(p,Vtc);%Solve AX=B using trisysX=trisys(Va,Vd,Vc,Vb);T=[a,Vt,b];X=[alpha,X,beta];F=[T' X'];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -