I just started to learn simulation about PDEs and encountered difficulties. How can I use method-of-lines to solve the following three variables and draw a graph?
Show older comments

13 Comments
Umar
on 21 Aug 2024
Hi @Yidan,
Could you please write these equations in text format, so they are legible enough to implement in Matlab. For example, I don’t know if you wrote dt or alpha with subscript t or Beta or B etc
Yidan
on 21 Aug 2024
What problems do you encounter to modify the solution I gave you for a 2-component system to a 3-component system ?
If you have problems using MATLAB, try MATLAB Onramp for an introduction to MATLAB free-of-costs to learn the basics of the language:
If you have problems with the numerics of hyperbolic equations, consult a textbook.
Another option is to use the trick suggested by Bill Greene to make "pdepe" work for your problem. Using "pdepe" for hyperbolic systems is problematic because one of the boundary conditions has to be artificially set and often, the computed solution shows some oscillations because the discretization scheme is not adequate. But the general trend should be ok.
p must be set to 0 and q must be set to 1 (or any other value) for those equations and boundary points for which you don't have a boundary condition - thus for alpha at x = 1 and for beta and Z at x = 0. p must be set to the value and q must be set to 0 for those equations and boundary points for which you have a boundary condition - thus for alpha at x = 0 and for beta and Z at x = 1. So can you spot your mistakes in the boundary function ?
Yidan
on 21 Aug 2024
Both solutions are wrong.
pl(1) = 2.2*ul(2)+ ul(1),
ql(1) = 0,
pr(1) = -ur(2)+0.19*ur(1)+ul(3),
qr(1) = 0
means that you set boundary conditions for alpha at x = 0 as well as at x = 1.
But this is not correct. You can only set a boundary condition for alpha at x = 0.
Yidan
on 21 Aug 2024
Torsten
on 21 Aug 2024
Sorry, but this is really a level of logic you should understand by yourself from what I said:
p must be set to 0 and q must be set to 1 (or any other value) for those equations and boundary points for which you don't have a boundary condition - thus for alpha at x = 1 and for beta and Z at x = 0.
p must be set to the value and q must be set to 0 for those equations and boundary points for which you have a boundary condition - thus for alpha at x = 0 and for beta and Z at x = 1.
Yidan
on 21 Aug 2024
Torsten
on 21 Aug 2024
You got it.
Yidan
on 21 Aug 2024
William Rose
on 21 Aug 2024
@Torsten is a good teacher.
Answers (0)
Categories
Find more on PDE Solvers in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!