Message Boards Message Boards

0
|
3875 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to plot a function with Plot3D

Posted 9 years ago

I am unable to plot a function of two variables f(x,y). Kindly, some one help me plot this function. Mathematica file is attached here.

u[x_] := Exp[-4 (x - 1)^2]

?[x_] := Exp[-Integrate[u[y]/0.2, {y, 0, x}]]

f[x_, t_] := Integrate[(x - z)/t ?[z] Exp[-(x - z)^2/(0.4 t)], {z, -?, ?}]/
             Integrate[?[z] Exp[-(x - z)^2/(0.4 t)], {z, -?, ?}]

Plot3D[f[x, t], {x, 1, 3}, {t, 1, 3}]
Attachments:
POSTED BY: Imran Khan
3 Replies

I tried doing you code step by step. The integral in the numerator of the definition of f is taking a long time. Have you tried NIntegrate instead of Integrate?

POSTED BY: Frank Kampas

Hi,

this here appears to work:

u[x_] := Exp[-4 (x - 1)^2];
\[Phi][x_] := Evaluate@Exp[-Integrate[u[y]/0.2, {y, 0, x}]];
f[x_, t_] := 
 NIntegrate[(x - z)/
   t \[Phi][z] Exp[-(x - z)^2/(
    0.4 t)], {z, -\[Infinity], \[Infinity]}]/
 NIntegrate[\[Phi][z] Exp[-(x - z)^2/(
    0.4 t)], {z, -\[Infinity], \[Infinity]}];

appears to work. Basically you have to use numerical integration instead of symbolic integration.

Plot3D[f[x, t], {x, 1, 3}, {t, 1, 3}]

enter image description here

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 9 years ago

Thanks a lot !

NIntegrate works.

POSTED BY: Imran Khan
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract