資源描述:
《matlab 實(shí)驗(yàn)六1數(shù)值微積分與常微分方程求解》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、實(shí)驗(yàn)六數(shù)值微積分與常微分方程求解一、實(shí)驗(yàn)?zāi)康?.掌握微分與積分的數(shù)值計(jì)算方法2.掌握常微分方程的數(shù)值求解方法二、實(shí)驗(yàn)內(nèi)容和步驟1.求函數(shù)指定點(diǎn)的數(shù)值導(dǎo)數(shù)2.求下列函數(shù)的導(dǎo)數(shù)(1),求(2)求3.用數(shù)值方法求定積分(1)(2)(3)(4)4.求微分方程的數(shù)值解(1)(2)三、程序清單及運(yùn)行結(jié)果1.程序清單:forx=1:1:3fx=[x,x^2,x^3;1,2*x,3*x^2;0,2,6*x];diff(fx)end運(yùn)行結(jié)果:2.(1)程序清單:x=0:0.05:1;y=x.^10+10.^x+1./log10(x);
2、dy=diff(y)/0.05運(yùn)行結(jié)果:(2)程序清單:x=0:0.01:1;y=log(1+x);dy=diff(y,2)/0.01;dy(99)運(yùn)行結(jié)果:3.(1)程序清單:fx=inline('x.^2.*sqrt(2*x.*x+3)');quad(fx,1,5)運(yùn)行結(jié)果:(2)程序清單:fx=inline('x./sin(x).^2');quad(fx,pi/4,pi/3)運(yùn)行結(jié)果:(3)程序清單:fx=inline('abs(cos(x+y))');dblquad(fx,0,pi,0,pi)運(yùn)行結(jié)果:(4)
3、程序清單:symsxy;fx=x*y;int(int(fx,y^2,y+2),-1,2);運(yùn)行結(jié)果:4.(1)程序清單:建立函數(shù)文件funst.m。functionyp=funst(t,y)yp=-(1.2+sin(10*t))*y;求解微分方程。t0=0;tf=5;y0=1;[t,y]=ode23(@funst,[t0,tf],y0)運(yùn)行結(jié)果:t=00.06670.13750.20030.26950.35280.43620.50330.56630.63690.69130.74570.80810.87380.9591
4、1.02771.09631.16001.22461.30821.37141.43471.50011.58421.65301.72191.78581.85011.93191.99532.05872.12362.20532.27452.34382.40802.47192.55012.61402.67792.74192.81932.90462.96853.03233.09593.17213.23643.30073.36423.43953.53283.59653.66023.72383.79983.86423.92863.9
5、9204.06714.14084.21444.28004.34324.41594.48124.54654.60944.68124.75674.83224.89904.96205.0000y=1.00000.90350.78220.68230.59840.54020.51820.51060.49760.46560.42800.38440.33550.29360.25950.24690.24210.23820.22900.20540.18190.15850.13870.12250.11640.11400.11220.10
6、800.09740.08640.07530.06580.05810.05490.05370.05290.05110.04660.04150.03610.03160.02780.02580.02530.02490.02410.02210.01970.01720.01500.01320.01220.01190.01170.01140.01040.00930.00810.00710.00620.00580.00560.00550.00540.00500.00450.00390.00340.00300.00270.00260
7、.00260.00250.0025(2)程序清單:建立函數(shù)文件verderpol.m。functionxprime=verderpol(t,x)xprime=[x(2);(2-3*x(1)-2*t*x(2))];求解微分方程。t0=0;tf=5;y0=[1;0];[t,x]=ode45(@verderpol,[0,5],y0)運(yùn)行結(jié)果:t=00.00010.00010.00020.00020.00050.00070.00100.00120.00250.00370.00500.00620.01250.01880.025
8、10.03130.06270.09410.12550.15690.26710.37720.48740.59750.72250.84750.97251.09751.20331.30921.41501.52081.60681.69281.77881.86471.91701.96922.02142.07362.12582.17812.23032.28