Help with Laplace ODE
显示 更早的评论
Help solving this laplace ode with
intial condition, my a and b values are
respectively. I have tried solving this Laplace ode without using my a and b values. below is my code.
Any help is massively appreciated! Thank you
syms t y(t) Y(s) Dy0 a b y0
Dy1 = diff(y,t,1);
eqn = laplace(Dy1== a*sinh(a*t));
eqn = subs(eqn, {laplace(y(t), t, s), subs(diff(y(t), t), t, 0), y(0)},{Y(s), 0,0})
cond= y(0)==22;
Ys(s)= simplify(eqn/Y);
yt = ilaplace(Ys,s,t)
采纳的回答
Try this —
syms t y(t) Y(s) Dy0 a b y0
Dy1 = diff(y,t,1);
eqn = laplace(Dy1== a*sinh(a*t))
eqn =

eqn = subs(eqn, {laplace(y(t), t, s), subs(diff(y(t), t), t, 0), y(0)},{Y(s), 0, 22}) % Substitute 'y(0)' Here
eqn =

% cond= y(0)==22;
eqn = isolate(eqn, Y)
eqn =

y(t,a) = ilaplace(rhs(eqn))
y(t, a) =

figure
fplot(y(t,34), [-0.1 0.1]) % Substitute 'a' Here
grid

.
10 个评论
THANK YOU SO MUCH !
Perfect!
As always, my pleasure!
How would I adapt the eqn formula to add another variable, for example:
where;
is the added term.
I tried changing the symbolic functions, but I am missing a term in the second eqn formula (subs). What do I need to do to solve this different ODE laplace ?, using the above solution?
Once again, any help massively appreciated. Thank you for answering my previous question
I would do something like this (the code is essentially the same) —
syms t y(t) Y(s) Dy0 a b y0 beta
Dy1 = diff(y,t,1);
eqn = laplace(Dy1 + beta*y == a*sinh(a*t))
eqn =

eqn = subs(eqn, {laplace(y(t), t, s), subs(diff(y(t), t), t, 0), y(0)},{Y(s), 0, 22}) % Substitute 'y(0)' Here
eqn =

eqn = isolate(eqn, Y)
eqn =

y(t,a,beta) = ilaplace(rhs(eqn))
y(t, a, beta) =

You may be able to simplify that further if you wish, and perhaps using partfrac before ilaplace.
To plot it with fplot, proivide values for both scalar parameters.
Once again, Thank you so much!
This is helping massively ! Made my day !
As always, my pleasure!
Sorry to bother again, now, I am trying to solve a laplace 2nd order equation:
To solve this I have slighlty adapted the code, however Im not sure where to put my new limit of Dy(0) (shown in code)
syms t y(t) Y(s) Dy0 a b y0
Dy1 = diff(y,t,1);
Dy2 = diff(y,t,2);
eqn = laplace(Dy2-10*Dy1 +9*y==5*t)
%%%
eqn = subs(eqn, {laplace(y(t), t, s), subs(diff(y(t), t), t, 0)},{Y(s), Dy0});
cond = [y(0)==-1, Dy1(0)==2];
%%%
eqn=isolate(eqn, Y)
y(t) = ilaplace(rhs(eqn))
I need to relate my condition back into the code, how would I do this ?
This code actually solves the 2nd order ODE, but at the end I have to plug in the values
for
and
. Below shows an attempt at finding solving the 2nd order by introducing another subs term. However, this does not work, because I need to define a condition for Dy(0) and theres a paranthesis error in the t,t,),t.
eqn= subs(eqn, {laplace(y(t), t, s), subs (diff(y(t),t,t),t ,0), subs(diff(y(t), t), t, 0), y(0), Dy1(0)},{Y(s), 0, -1});
Also, before I ask again, to solve a 3rd order laplace ODE, I would have to repeat the same added procedural steps for solving a 2nd order ODE?
Any help massively appreciated!
I believe this does what you want —
syms t y(t) Y(s) Dy0 a b y0
Dy1 = diff(y,t,1);
Dy2 = diff(y,t,2);
eqn = laplace(Dy2-10*Dy1 +9*y==5*t)
eqn =

eqn = subs(eqn, {laplace(y(t), t, s), subs(diff(y(t), t), t, 0), y(0)},{Y(s), 2, -1})
eqn =

%%%
eqn=isolate(eqn, Y)
eqn =

y(t) = ilaplace(rhs(eqn))
y(t) =

figure
fplot(y, [0 1])
grid
xlabel('t')
ylabel('y(t)')

Check to be sure the substitutions are correct.
Thank you so much x10. Made my day again !
massively appreciated, words cant express it !
As always, my pleasure!
(A Vote would be appreciated!)
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
标签
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
