1

I am working on a solution to solve a Partial Differential Equation, Fick's Second Law of Diffusion to be exact. I was able to produce a 3D Plot using the NDSolve and Plot3D functions. Code used:

NDSolve[{D[c[t, h], t] == 1*D[c[t, h], h, h],
               c[0, h] == Erfc[h/(2*81.2)], 
               c[t, 0] == 1, 
            c[t, 4000] == 3.08*^-18}, c, {t, 0, 900}, {h, 0, 274}]

Instead of a graphical representation, I would like to find numerical points of the graph at t = 900. I would like to know how to put in t = 900 into NDSolve (or other functions) so as to generate detailed numerical points of the solution.

4

1 回答 1

0

尝试先将解决方案保存在变量中:

e = NDSolve[{D[c[t, h], t] == 1*D[c[t, h], h, h], c[0, h] == Erfc[h/(2*81.2)], c[t, 0] == 1, c[t, 4000] == 3.08*^-18}, c, {t, 0, 900}, {h, 0, 274}]

然后我们可以为我们想要的变量评估这个表达式:

Evaluate[c[900, 10] /. e]
(*{0.914014}*)

或者为了让它更通用,我们可以使用 Manipulate:

Manipulate[Evaluate[c[t, h] /. e], {t, 0, 900}, {h, 0, 274}]

操纵

更新: 考虑到我从以下评论中收到的信息;我们可以定义一个像q[t,h]这样的函数,它将给我们一个函数的解决方案:

q[t_, h_] := Evaluate[c[t, h] /. e]
q[900, 10]
(*{0.914014}*)
于 2013-06-26T06:03:02.133 回答