How do I use a step function in Boundary value problem ?

Hi,
. I am using sol = bvp4c(odefun,bcfun,solinit). I don't know how to include a step function in my differential equation defined in odefun. Is it possible to do so or odefun can only handle predefined functions? Thankyou for reading. Any suggestion is highly appreciated.

9 件のコメント

Torsten
Torsten 2022 年 11 月 10 日
Please include the problem you are trying to solve with equations and boundary conditions.
Gaurav Singh
Gaurav Singh 2022 年 11 月 10 日
Thanks for replying on this thread. Here is the differential equation:
y''''-2*y''+(T+beta)*y=0; where y,T are functions of x; -b<x<b ; beta is a parameter.
T is a step function.
T= -Tc -a<x<a
T= Tc+gamma elsewhere
Tc and gamma are constants.
Bcs: at x=+b, x=-b;
y'''-1.7*y'=0 at x=b, x=-b;
y''-0.3*y=0 at x=b, x=-b
If I arbitrarily chose T as a constant, I get some solution. I have guessed an initial solution of the form sin(p*x). As the equation involves a parameter beta, I have to guess one additional bc to solve for beta. I have just chosen y'=1, not sure if this is right bc though.
Torsten
Torsten 2022 年 11 月 10 日
Your ODE coefficients have a jump at x = +/- a. So without transmission conditions at x = +/-a , you won't be able to fix a solution.
Gaurav Singh
Gaurav Singh 2022 年 11 月 10 日
編集済み: Gaurav Singh 2022 年 11 月 10 日
Suppose I make a smoth transition around point 'a', is it possoble to put this T(x) in the differential equation through odefun?
Torsten
Torsten 2022 年 11 月 10 日
If around -a and a, then yes.
Gaurav Singh
Gaurav Singh 2022 年 11 月 10 日
Thanks for confirming. Can you share any example how to do that using odefun, in bvp4c?
Torsten
Torsten 2022 年 11 月 10 日
編集済み: Torsten 2022 年 11 月 10 日
What is the problem ? Making the discontinuous function T(x) smooth around x=-a and x=a ?
But I think the solution to your ODE will greatly depend on how you choose the smoothing function. Thus the solution is kind of arbitrary.
Bjorn Gustavsson
Bjorn Gustavsson 2022 年 11 月 11 日
Fourth derivatives brings back memories (very very vague ones) of the one course in solid mechanics and bending beams and bridges. There we had tables of solutions for different kinds of loads and end-conditions. If this is your problem it might be possible to piece together a solution from such characteristic solutions that fits these conditions.
Gaurav Singh
Gaurav Singh 2022 年 11 月 11 日
Thanks Bjorn. The step function makes life a bit difficult.

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

回答 (1 件)

Gaurav Singh
Gaurav Singh 2022 年 11 月 11 日

0 投票

Thankyou all. I guess, I have figured it out. For now, I am able to use heaviside function in my problem. Here is the code;
function dydx = mat4ode(x,y,lambda) % equation being solved
global k
dydx = [y(2)
y(3)
y(4)
2*k^2*y(3)-(1*(-heaviside(x+1)+heaviside(x-1)+0.5)+lambda)*y(1)];
end

2 件のコメント

Torsten
Torsten 2022 年 11 月 11 日
編集済み: Torsten 2022 年 11 月 11 日
This will introduce jumps at x+1 and x-1 for every point x of your grid vector. I doubt that this is what you want.
Gaurav Singh
Gaurav Singh 2022 年 11 月 11 日
編集済み: Gaurav Singh 2022 年 11 月 11 日
Thanks for your comment Torsten. Can you please elaborate more on this. May be I am missing something important here. From my understanding, as its a forth order DE, the solver gives me continuous function up to order three. The third derivative is having sharp corner at x=+1 and -1.
I belive fourth derivative will be discontinuous. Is there any fundamental err in suppyling heaviside function directly in DE in Matlab?

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

カテゴリ

製品

リリース

R2022a

質問済み:

2022 年 11 月 10 日

コメント済み:

2022 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by