andren 发表于 2013-10-11 23:06:08

谁会编程解二阶微分方程

vb能做吗

freddy 发表于 2013-10-12 06:56:57

matlab做

sunhaiyan 发表于 2014-7-14 00:28:29

matlab 二阶微分方程

>> clear
>> syms a b c d e;
>> y=dsolve('a*D2y+b*Dy+c*y=0','y(0)=d','Dy(0)=e')

y =

(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))

>> a=1;b=1;c=1;d=1;e=1;%若常数已知

>> t=1;%desolve中没指定自变量x,这里默认为t,带入任意一个x值
>> y=eval(y)

y =

   1.1932 + 0.0000i
这是解方程的方法,画图也差不多,我在命令窗写的改麻烦,下面是我在editor写的。
syms a b c d e;
y=dsolve('a*D2y+b*Dy+c*y=0','y(0)=d','Dy(0)=e','x');
x=200:0.1:400;%取值范围,步长
a=1;b=1;c=1;d=1;e=1;%带入参数
y=eval(y);
plot(x,y)

youhuizhong 发表于 2014-7-31 23:39:02

大神跑这来问问题。。厉害~!~
vb做界面了,matlab做比较轻松愉快~!~
页: [1]
查看完整版本: 谁会编程解二阶微分方程