Solving ODE/PDE's in Matlab: Advice for Using pde Function

  • MATLAB
  • Thread starter n0_3sc
  • Start date
  • Tags
    Matlab
In summary, the conversation discusses two partial differential equations (PDEs) in terms of dz and dt, respectively, and the function I(t). The first equation determines how I(t) varies with z, while the second equation involves the function N(t,z). The letters on the right-hand side of the equations are constants, and the conversation also mentions a boundary condition for N(t,z). The discussion also mentions using MATLAB's pde function to solve this problem, but notes that it may be difficult to follow the examples provided.
  • #1
n0_3sc
243
1
I have two PDE's. One in terms of dz and the other in terms of dt:

[tex]\frac{dI(t,z)}{dz}=aI(t,z) + bI^2(t,z) - cN(t,z)I(t,z)[/tex]
and
[tex]\frac{dN(t,z)}{dt}=dI^2(t,z) - eN(t,z)[/tex]

I know the function:
[tex]I(t)[/tex]

I'd like advice on how to attempt this problem on MATLAB using the pde function. (Matlab's examples are too complex to follow).
 
Physics news on Phys.org
  • #2
I might be able to help given that I know at least a little about diff eq.s in matlab, but first:

you say you know I(t), but in your equations I appears as a function of two variables. And if you know THAT function, then what's the use of the first equation?
 
  • #3
Because I know I(t) the first equation determines how I(t) varies with z thus giving I(t,z).

I should also mention letters on the rhs "a,b,c,d,e" are constants.
 
  • #4
I'm still not quite getting it. When you say that you know I(t), do you mean that you know I(t,0) or something like that?
 
  • #5
Yeah sorry it can be a bit confusing when solving a pde in this way.

Here's what I(t) is:
[tex]I(t) = I_{max}exp(\frac{-t^2}{T})[/tex]

I(t,0) = I(t).

The first ODE modifies I(t) as it varies with z giving I(t,z).
 
  • #6
Aha. Okay, got it, thanks. Do you have a similar boundary condition for N(t,z)? I don't think MATLAB can do much with it if not.
 
  • #7
Sure, I can think of this one as being a suitable condition:

[tex]N(t=-\infty,z) = 0[/tex]
 

1. What is the difference between ODEs and PDEs?

ODEs (ordinary differential equations) involve a single independent variable, while PDEs (partial differential equations) involve multiple independent variables. ODEs can be solved using analytical methods, while PDEs often require numerical methods.

2. How does the pde function in Matlab work?

The pde function in Matlab is used to solve PDEs numerically. It takes in the PDE equation, boundary conditions, and mesh information as input and returns the numerical solution to the PDE.

3. What is the best way to choose a mesh for my PDE problem?

Choosing an appropriate mesh is crucial for obtaining an accurate solution to a PDE problem. It is best to start with a coarse mesh and gradually refine it until the solution converges. Matlab also has built-in functions to help with mesh generation, such as generateMesh.

4. Can the pde function handle complex PDEs?

Yes, the pde function in Matlab can handle complex PDEs with multiple variables and terms. However, it is important to carefully check the input parameters and boundary conditions to ensure they are correctly specified for the specific PDE problem.

5. Are there any common mistakes to avoid when using the pde function?

One common mistake is not specifying the correct boundary conditions or mesh for the PDE problem. It is also important to check for any typos or errors in the PDE equation. Additionally, using too coarse of a mesh can lead to inaccurate solutions, so it is important to refine the mesh as needed.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
246
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
927
Replies
1
Views
599
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top