Sovling Bernoulli's differential equation in matlab?

In summary, the question asks for help with a first order bernoullis differential equation. The person is looking for a numerical method to solve the equation, and suggests using the Klett method.
  • #1
Eswin Paul T
6
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
  • #2
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?
 
  • #3
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.
 
  • #4
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,
[tex]x \frac{dy}{dx} + y = x^2 y^2[/tex]
Bernoulli equations have the standard form
[tex]y' + p(x) y = q(x) y^n[/tex]
So the first equation in this standard form is
[tex]\frac{dy}{dx} + \frac{1}{x} y = x y^2[/tex]

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

Related to Sovling Bernoulli's differential equation in matlab?

1. What is Bernoulli's differential equation?

Bernoulli's differential equation is a type of first-order nonlinear ordinary differential equation, named after Swiss mathematician Daniel Bernoulli. It has the form dy/dx + P(x)y = Q(x)y^n, where P(x) and Q(x) are functions of x and n is a constant. It is commonly used in physics and engineering to model various physical phenomena.

2. How can I solve Bernoulli's differential equation in MATLAB?

There are several ways to solve Bernoulli's differential equation in MATLAB. One way is to use the built-in function dsolve, which can symbolically solve differential equations. Another way is to use numerical methods, such as ode45 or ode23, which can numerically approximate the solution.

3. What is the syntax for solving Bernoulli's differential equation in MATLAB?

The syntax for solving Bernoulli's differential equation using dsolve is dsolve('dy/dx + P(x)y = Q(x)y^n', 'y(x)'), where P(x) and Q(x) are the functions in the equation and y(x) is the dependent variable. For numerical methods, the syntax varies depending on the specific method being used.

4. Can I graph the solution to Bernoulli's differential equation in MATLAB?

Yes, you can graph the solution to Bernoulli's differential equation in MATLAB using the ezplot function. The syntax is ezplot('y(x)', [a, b]), where y(x) is the solution and [a, b] is the interval over which to plot the graph.

5. Are there any special considerations when solving Bernoulli's differential equation in MATLAB?

Yes, when using numerical methods, it is important to choose appropriate initial conditions and to ensure that the solution does not contain any singularities. Additionally, the value of n in the equation must be carefully selected to avoid division by zero. It is also important to check the accuracy and stability of the solution obtained.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
984
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top