|
发表于 2014-7-14 00:28:29
|
显示全部楼层
matlab 二阶微分方程! i8 u- Y" M* M. s% p- e; {
5 K& w% b; u% C7 M6 k3 e X>> clear
( g: v6 O; f0 `0 y2 X/ g Y$ a>> syms a b c d e;( |- e) c) \/ R2 O0 C+ t2 w) S
>> y=dsolve('a*D2y+b*Dy+c*y=0','y(0)=d','Dy(0)=e')% G; z4 Y$ H4 t7 g" _' i- j
: x( Y5 ?2 J5 S0 J- ?& Oy =
; C. m# E. h: a* F3 j- \6 Q/ Z & j' y3 _) S* e8 z; M$ n) f+ g( ?
(2*a*e + b*d + d*(b^2 - 4*a*c)^(1/2))/(2*exp((t*(b - (b^2 - 4*a*c)^(1/2)))/(2*a))*(b^2 - 4*a*c)^(1/2)) - (2*a*e + b*d - d*(b^2 - 4*a*c)^(1/2))/(2*exp((t*(b + (b^2 - 4*a*c)^(1/2)))/(2*a))*(b^2 - 4*a*c)^(1/2))
T/ e1 H- u9 ^' K: X1 G
( ~& d% L/ F9 k# e* W0 G>> a=1;b=1;c=1;d=1;e=1;%若常数已知
5 S3 } o9 G7 K. w0 H! w& {, [' P4 \6 U; O2 f6 `/ R+ |
>> t=1;%desolve中没指定自变量x,这里默认为t,带入任意一个x值3 k8 u }$ b* R) s; J
>> y=eval(y) : ^) a8 I. P9 Y K
& t- @3 ^: g2 t" u" q0 k# h
y =$ k1 e# Z4 _2 L8 B' y4 g
9 A+ F5 b6 ^9 O# d6 O 1.1932 + 0.0000i
+ r9 y7 @! W; Q" Q这是解方程的方法,画图也差不多,我在命令窗写的改麻烦,下面是我在editor写的。# e4 {, e3 s8 u# [5 G1 l F) I5 v
syms a b c d e;
8 i: N; W/ z2 N4 ?5 k7 n+ Hy=dsolve('a*D2y+b*Dy+c*y=0','y(0)=d','Dy(0)=e','x');+ f, P/ v2 U" t; W v- M
x=200:0.1:400;%取值范围,步长
2 N1 N) ^2 g5 r3 a8 o1 ta=1;b=1;c=1;d=1;e=1;%带入参数0 g6 u- k) ?2 r8 G( Y
y=eval(y);
. z7 N2 J' ]" T; N \ Fplot(x,y) |
|