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)

 採用された回答

Star Strider
Star Strider 2021 年 5 月 4 日

1 投票

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 件のコメント

gurjeevan singh
gurjeevan singh 2021 年 5 月 4 日
THANK YOU SO MUCH !
Perfect!
Star Strider
Star Strider 2021 年 5 月 4 日
As always, my pleasure!
gurjeevan singh
gurjeevan singh 2021 年 5 月 4 日
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
Star Strider
Star Strider 2021 年 5 月 4 日
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.
gurjeevan singh
gurjeevan singh 2021 年 5 月 4 日
Once again, Thank you so much!
This is helping massively ! Made my day !
Star Strider
Star Strider 2021 年 5 月 4 日
As always, my pleasure!
gurjeevan singh
gurjeevan singh 2021 年 5 月 4 日
Sorry to bother again, now, I am trying to solve a laplace 2nd order equation:
with conditions , .
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!
Star Strider
Star Strider 2021 年 5 月 4 日
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.
gurjeevan singh
gurjeevan singh 2021 年 5 月 5 日
Thank you so much x10. Made my day again !
massively appreciated, words cant express it !
Star Strider
Star Strider 2021 年 5 月 5 日
As always, my pleasure!
(A Vote would be appreciated!)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by