Message Boards Message Boards

0
|
11722 Views
|
5 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Plot solution of differential equation with conditional constant term

Posted 11 years ago
Hi.

I intend to plot a function with a term 'F' which is dependant on the value of 'y':
 m := 1200
 k := 300000
 b := 25
 g := 9.81
 F := If[y[t] < -0.4, -m g +
    Abs[b (-y'[t]) Sqrt[y[t] + 0.4] + k y[t]], -m g]
 y''[t_] := F/m
 system = DSolve[{y''[t_] := F/m, y[0] == 0, y'[0] == 0}, y, t]
 Plot[y[t] /. system, {t, 0, 5}]
The scenario is a falling object which can be modelled as a damper and spring; once it hits the floor then a bouncing force will arise, defined when y=-0.4. I am not sure how to go about this. Thanks for any help!
POSTED BY: Julian Lovlie
5 Replies
May be so:
m := 1200
k := 300000
b := 25
g := 9.81
F[t_] := If[y[t] < -0.4, -m g + Abs[b (-y'[t]) *Sqrt[y[t] + 0.4] + k y[t]], -m g]
system = NDSolve[{y''[t] == F[t]/m, y[0] == 1, y'[0] == 0},y, {t, 0, 5}]
Plot[y[t] /. system, {t, 0, 5}]

emoticon
POSTED BY: Rosen MITREV
Posted 11 years ago
Allright! Thanks mate!
POSTED BY: Julian Lovlie
julian, you may also take a quick look of this documentation about event locator method in Mathematica 9.
POSTED BY: Shenghui Yang
While "EventLocator" still exists for backward compatibility, starting with Mathematica 9 the recommended tutorial would be

Events and Discontinuities in Differential Equations.
POSTED BY: Ilian Gachevski
Posted 11 years ago
Thanks guys emoticon
POSTED BY: Julian Lovlie
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