Spatial source for diffusion equation
Show older comments
Hi all, I would like to solve a diffusion equation -d^2n/dx^2 = S(x) in 1D between -L < x < +L, with a spatial source term, for instance "1" between -0.1L < x < 0.1L and 0 elsewhere. I'm a bit confused by the structure of pdepe. And I can't find an example with a source term.
Can anybody help me ?
Thanks a lot
Stéphane
Answers (1)
Torsten
on 14 Jun 2016
0 votes
Just take pencil and paper and integrate n''(x)=S(x) twice with respect to x.
If you don't succeed, use bvp4c instead of pdepe since your equation is stationary.
Best wishes
Torsten.
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!