Sovling Bernoulli's differential equation in matlab?

Click For Summary

Discussion Overview

The discussion revolves around solving a first-order Bernoulli differential equation using MATLAB. Participants seek assistance with the context of the problem, the specific equation, and the numerical methods applicable for solving it.

Discussion Character

  • Homework-related
  • Technical explanation

Main Points Raised

  • One participant requests help with solving a first-order Bernoulli differential equation in MATLAB.
  • Another participant inquires about the context of the question, the level of experience with MATLAB, the specific differential equation, and the numerical method intended for use.
  • A participant mentions working on lidars to retrieve extinction coefficients and explains that they need to solve the lidar equation using the Klett method, which involves reducing it to a first-order Bernoulli equation.
  • A later reply provides a specific example of a Bernoulli differential equation and outlines methods for solving it in MATLAB, including using the ode45 solver and symbolic solutions, while emphasizing the need for more information about the specific equation to provide tailored assistance.

Areas of Agreement / Disagreement

Participants generally agree on the need for more specific information regarding the differential equation to provide effective help. However, there is no consensus on the exact approach to take without further details.

Contextual Notes

Participants have not provided the specific differential equation or initial conditions, which limits the ability to offer precise guidance. The discussion also reflects varying levels of familiarity with MATLAB and the methods for solving differential equations.

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,597
  • Like
Likes   Reactions: Greg Bernhardt and berkeman

Similar threads

Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K