MATLAB Sovling Bernoulli's differential equation in matlab?

AI Thread Summary
The discussion revolves around solving a first-order Bernoulli differential equation using MATLAB, specifically in the context of applying the Klett method for lidar data analysis to retrieve the extinction coefficient. The equation provided is in the standard form of Bernoulli equations, which is y' + p(x) y = q(x) y^n. A numerical solution can be obtained using MATLAB's ode45 function, which requires defining the differential equation in a function format and specifying initial conditions and time spans. Additionally, a symbolic solution is possible, which may involve using the Symbolic Math Toolbox for more complex integrations. The conversation emphasizes the need for more specific details about the equation and initial conditions to provide tailored assistance.
Eswin Paul T
Messages
6
Reaction score
0
I have a first order bernoullis differential equation. I need to solve this in matlab. Can anyone help me?
 
Physics news on Phys.org
Eswin Paul T said:
I have a first order bernoullis differential equation. I need to solve this in matlab. Can anyone help me?
What is the context of the question? Is this for schoolwork?

What is your level of experience with MATLAB? What is the DE (and the initial conditions), and which numerical method do you have in mind for solving it?
 
berkeman said:
What is the context of the question? Is this for schoolwork?

What is your level of experience with MATLAB? What is the DE (and the initial conditions), and which numerical method do you have in mind for solving it?
I am working on lidars to retrieve extinction coefficient. I have to solve the lidar equation using Klett method which involves reducing the lidar eqn to a first order bernoullis equation.
 
I can't provide specific help since you didn't provide the equation, so instead I'll show you some ways to solve one of the Bernoulli equations in the Wikipedia article on Bernoulli differential equation.

The differential equation is,
x \frac{dy}{dx} + y = x^2 y^2
Bernoulli equations have the standard form
y' + p(x) y = q(x) y^n
So the first equation in this standard form is
\frac{dy}{dx} + \frac{1}{x} y = x y^2

Initial Value Problem
If you want to calculate a numerical solution to the equation by starting from a known initial state and simulating forward to a predetermined end point, then you have an initial value problem. The main ODE solver in MATLAB is ode45, and it only takes a few lines in a script to solve this equation for some initial condition y0 over a period of time tspan (I picked some random values):

Code:
y0 = 0.1;
tspan = [0.5 20];

[x,y] = ode45(@bernoulli1, tspan, y0);
plot(x,y)

function dydx = bernoulli1(x,y)
% This function codes the equations and
% is called at each time step by ode45 to
% advance the integration.
dydx = x*y^2 - y*(1/x);
end

bernoulli1.png


Symbolic Solution
Instead of simulating the system, you can express it as a linear differential equation and solve it using known techniques (see here). This doesn't really require MATLAB, but if the expressions are complicated you can use Symbolic Math Toolbox to perform some of the integrations.

Hopefully this general information is helpful. If you post more info on the equation you need to solve then maybe we can see about which technique is best.
 

Attachments

  • bernoulli1.png
    bernoulli1.png
    11 KB · Views: 2,530
  • Like
Likes Greg Bernhardt and berkeman

Similar threads

Replies
1
Views
2K
Replies
5
Views
3K
Replies
32
Views
4K
Replies
4
Views
4K
Replies
5
Views
3K
Replies
1
Views
1K
Back
Top