Given a DSolve example:

sol = Flatten[

DSolve[{D[x[t, th], {t, 2}] == -0.2*D[x[t, th], t]/2.30,

Derivative[1, 0][x][0, th] == 10.8*Cos[th], x[0, th] == 0},

x[t, th], t]]

Then assigning sol to a function:

x[t,th]/.sol[[1]]

I’m having trouble plotting a 2D portion of it:

Plot[x[t,1],{t,0,20}]

And also trouble Manipulating it:

Manipulate[x[t,th], {th, 0, Pi/2}]

What mistakes am I making?

=================

=================

1 Answer

1

=================

I’m not sure what you think x[t,th]/.sol[[1]] does. From your question, Here is what I think you’re trying to accomplish.

sol = Flatten[ DSolve[{D[x[t, th], {t, 2}] == -0.2*D[x[t, th], t]/2.30,

Derivative[1, 0][x][0, th] == 10.8*Cos[th], x[0, th] == 0},

x[t, th], t]];

x[t_, th_] = sol[[1, 2]]; (* This defines the function using the solution from DSolve *)

To get the Plot do the following:

Plot[x[t, 1], {t, 0, 20}]

To Manipulate, do the following:

Manipulate[Plot[x[t, th], {t, 0, 100}, PlotRange -> {{0, 100}, {0, 130}}], {th, 0, Pi/2}]

Hope this helps.

Thanks @RunnyKine. I’m taking a look now.

– xaxXos

Feb 4 ’13 at 16:14

I edited your code so that the manipulate shows how the function transforms (added a constant range: PlotRange -> {{0, 100}, {0, 130}}. I hope you don’t mind.

– gpap

Mar 13 ’13 at 15:27

@gpap. Thanks for the edit. Looks good.

– RunnyKine

Mar 13 ’13 at 15:55