《高等应用数学问题的MATLAB求解》——第7章习题代码

(1)原例题以及练习

>> syms t;u=sin(t);uu=diff(u)+3*u;
>> y=dsolve(['D5y+5*D4y+12*D3y+16*D2y+12*Dy+4*y=',char(uu)],'y(0)=0','Dy(0)=0','D2y(0)=0','D3y(0)=0','D4y(0)=0')
>> %Support of character vectors and strings will be removed in a future release. Use sym objects to define differential equations instead. 

结果

\[{\mathrm{e}}^{-t}-\frac{\cos\left(t\right)}{5}-\frac{2\,\sin\left(t\right)}{5}-\frac{4\,{\mathrm{e}}^{-t}\,\cos\left(t\right)}{5}+\frac{11\,{\mathrm{e}}^{-t}\,\sin\left(t\right)}{10}-\frac{t\,{\mathrm{e}}^{-t}\,\cos\left(t\right)}{2} \]

>> syms t x(t) y(t); uu=diff(sin(t))+3*sin(t);
>> y1=diff(y);y2=diff(y,2);y3=diff(y,3);y4=diff(y,4);y5=diff(y,5);
>> z1=dsolve(y5+5*y4+12*y3+16*y2+12*y1+4*y==uu,y(0)==0,y1(0)==0,y2(0)==0,y3(0)==0,y4(0)==0);
>> z1=simplify(z1)

结果

\[{\mathrm{e}}^{-t}-\frac{\cos\left(t\right)}{5}-\frac{2\,\sin\left(t\right)}{5}-\frac{4\,{\mathrm{e}}^{-t}\,\cos\left(t\right)}{5}+\frac{11\,{\mathrm{e}}^{-t}\,\sin\left(t\right)}{10}-\frac{t\,{\mathrm{e}}^{-t}\,\cos\left(t\right)}{2} \]

(2)

>> syms t y(t); u=exp(-2*t)*( sin(2*t+pi/3)+cos(3*t) );
>> y1=diff(y);y2=diff(y1);y3=diff(y2);y4=diff(y3);y5=diff(y4);
>> z=dsolve(y5+13*y4+64*y3+152*y2+176*y1+80*y==u,y(0)==1,y(1)==3,y(pi)==2,y1(0)==1,y1(1)==2);
>> z=simplify(z);latex(z)

(3)

>> syms t x(t) y(t);
>> [x1 y1]=dsolve(diff(x,t,2)-2*diff(y,t,2)+diff(y,t)+x-3*y==0,4*diff(y,t,2)-2*diff(x,t,2)-diff(x,t)-2*x==5*y)

>> syms t x(t) y(t);
>> [x1 y1]=dsolve(2*diff(x,t,2)+2*diff(x,t,1)-x+3*diff(y,t,2)+diff(y,t,1)+y==0,diff(x,t,2)+4*diff(x,t,1)-x+diff(y,t,2)+2*diff(y,t)-y==0)

(4)

>> syms t x(t) y(t);
>> [x1 y1]=dsolve(diff(x,t,2)+5*diff(x,t)+4*x+3*y==exp(-t)*sin(4*t),2*diff(y,t)+y+4*diff(x,t)+6*x==exp(-t)*cos(4*t),x(0)==1,x(pi)==2,y(0)==0)

(5)

1

>> syms t x(t) n;
>> x1=dsolve((1-t^2)*diff(x,t,2)-2*t*diff(x)+n*(n+1)*x==0,t)

2

>> syms t x(t) n;
>> x1=dsolve(t^2*diff(x,t,2)+t*diff(x,t)+(t^2-n^2)*x==0)

(6)

>> syms x y(x);
>> y1=simplify(dsolve(diff(y,x,2)-(2-1/x)*diff(y,x)+(1-1/x)*y==x^2*exp(-5*x)))
>> y2=simplify(dsolve(diff(y,x,2)-(2-1/x)*diff(y,x)+(1-1/x)*y==x^2*exp(-5*x),y(1)==pi,y(pi)==1))

(8)

>> syms t x(t); x1=dsolve(diff(x,t,2)+2*t*diff(x,t)+t^2*x==t+1)

>> syms x y(x); y1=dsolve(diff(y,x)+2*x*y==x*exp(-x^2))

>> syms t y(t); y1=dsolve(diff(y,t,3)+3*diff(y,t,2)+3*diff(y,t)+y==exp(-t)*sin(t))

(9)

>> syms x y(x); y1=dsolve(diff(y,x)==y^4*cos(x)+y*tan(x))

>> syms x y(x);y1=dsolve(x*y^2*diff(y,x)==x^2+y^2)

>> syms x y(x);y1=dsolve(x*diff(y,x)+2*y+x^5*y^3*exp(x)==0)

(10)

>> syms t x(t) y(t);
>> x1(t)=diff(x,t);x2(t)=diff(x1,t);y1(t)=diff(y,t);y2(t)=diff(y1,t);[x0 y0]=dsolve(2*x2-x1+9*x-(y2+y1+3*y)==0,2*x2+x1+7*x-(y2-y1+5*y)==0,x(0)==1,x1(0)==1,y(0)==0,y1(0)==0)
posted @ 2020-07-25 00:03  Math&Nav  阅读(479)  评论(0编辑  收藏  举报