用matlab解微分方程
展开全部
楼主是要解析解吧
dsolve('Dy=A/V-B/V*sqrt(2*g*y)','y(0)=h0','t')
ans =
(2^(1/2)*A + 2^(1/2)*A*lambertw(0, (2^(1/2)*B*g^(1/2)*exp(-(A + B^2*g*(t/V - (A*(log(-(exp(-(A + 2^(1/2)*B*(g*h0)^(1/2))/A)*(2*B*(g*h0)^(1/2) + 2^(1/2)*A))/(2*B*g^(1/2))) + 1))/(B^2*g)))/A))/A))^2/(4*B^2*g)
(2^(1/2)*A + 2^(1/2)*A*lambertw(0, (2^(1/2)*B*g^(1/2)*exp(-(A + B^2*g*(t/V - (A*(log((exp(-(A - 2^(1/2)*B*(g*h0)^(1/2))/A)*(2*B*(g*h0)^(1/2) - 2^(1/2)*A))/(2*B*g^(1/2))) + 1))/(B^2*g)))/A))/A))^2/(4*B^2*g)
lambert w叫Ω函数或乘数对数,属于复变函数的范畴
所以还是用数值解的好
dsolve('Dy=A/V-B/V*sqrt(2*g*y)','y(0)=h0','t')
ans =
(2^(1/2)*A + 2^(1/2)*A*lambertw(0, (2^(1/2)*B*g^(1/2)*exp(-(A + B^2*g*(t/V - (A*(log(-(exp(-(A + 2^(1/2)*B*(g*h0)^(1/2))/A)*(2*B*(g*h0)^(1/2) + 2^(1/2)*A))/(2*B*g^(1/2))) + 1))/(B^2*g)))/A))/A))^2/(4*B^2*g)
(2^(1/2)*A + 2^(1/2)*A*lambertw(0, (2^(1/2)*B*g^(1/2)*exp(-(A + B^2*g*(t/V - (A*(log((exp(-(A - 2^(1/2)*B*(g*h0)^(1/2))/A)*(2*B*(g*h0)^(1/2) - 2^(1/2)*A))/(2*B*g^(1/2))) + 1))/(B^2*g)))/A))/A))^2/(4*B^2*g)
lambert w叫Ω函数或乘数对数,属于复变函数的范畴
所以还是用数值解的好
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1. 编写微分方程的函数保存为tmp_diff.m
function dh = tmp_diff(t,h,A,B,g,V)
dh = V/A-B/A*(2*g*h)^0.5;
return
2. 主程序中给定A,B,V,g, h0的值,再给定tspan,即时间范围
example:
A = 1; B =2; g =10; V = 1; h0=0;tspan = 0:1:2;
[t h] = ode15s(@tmp_diff,tspan,h0,[ ],A,B,g,V);
也可以是用ode45来计算
[t h] = ode45(@tmp_diff,tspan,h0,[ ],A,B,g,V);
>> [t h]
ans =
0 0
1.0000 0.0125
2.0000 0.0125
function dh = tmp_diff(t,h,A,B,g,V)
dh = V/A-B/A*(2*g*h)^0.5;
return
2. 主程序中给定A,B,V,g, h0的值,再给定tspan,即时间范围
example:
A = 1; B =2; g =10; V = 1; h0=0;tspan = 0:1:2;
[t h] = ode15s(@tmp_diff,tspan,h0,[ ],A,B,g,V);
也可以是用ode45来计算
[t h] = ode45(@tmp_diff,tspan,h0,[ ],A,B,g,V);
>> [t h]
ans =
0 0
1.0000 0.0125
2.0000 0.0125
追问
我是想在结果中用A、B、V、g h0表示
追答
matlab是数字运算,不能带字符串运算的吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询