Error function plot with two variables

14 visualizzazioni (ultimi 30 giorni)
JUNHO JANG
JUNHO JANG il 12 Giu 2019
Commentato: Star Strider il 12 Giu 2019
Hello guys I have to plot c(x,t)=c0-(c0-cs)erf(x/(2(Dt)^1/2)) Boundary condition is t>0, when the x is infinite, c=0. the fick's 2nd law.

Risposte (2)

Star Strider
Star Strider il 12 Giu 2019
You will need the meshgrid (link) or (ndgrid (linked to on that page)) functions, and the surf (link) (or mesh (linked to on that page)) functions. The erf (link) function will make that calculation easier.
Code it. If you have problems, post back here with your code, a complete description of the problem, and all the red text from your Command Window for any errors that your code throws.
  3 Commenti
Torsten
Torsten il 12 Giu 2019
Did you look at the examples provided under
?
They are almost identical to what you are trying to do.
Star Strider
Star Strider il 12 Giu 2019
@Junho Jang —
You are not using the correct plotting function.
Try this:
fsurf(2E-5*(1-erf(x/(2E-5*t))))
@Torsten —
Thank you!

Accedi per commentare.


Steven Lord
Steven Lord il 12 Giu 2019
The fplot function is not the right tool for this job. Its documentation states that when called with one symbolic input it "plots symbolic input f over the default interval [-5 5]."
If you scroll down to the bottom of the documentation page for fplot there are a few other related functions listed. Two of the functions listed there will allow you to plot your surface (fmesh or fsurf.) fsurf when called with one symbolic input "creates a surface plot of the symbolic expression f(x,y) over the default interval [-5 5] for x and y." That sounds like what you're trying to do.
Of course, all of fplot, fmesh, and fsurf are supported not just for symbolic inputs but can accept function handles. See the examples on the documentation page for the fsurf function in MATLAB and try to adapt them to your problem.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by