Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. Manipulatedelastance[t0_, t1_, tdelay_, period_] := Module[{},
  2.  
  3. Originalfunc =
  4. 0.05 + Piecewise[{{3.95 (1 - Cos[2 Pi Mod[t, 1]/0.3])/2,
  5. Mod[t, 1] < 0.3}}];
  6. ToBeAddedfunction = 3.95 (1 - Cos[2 Pi Mod[t - tdelay, 1]/period])/2;
  7. Combinedfunction =
  8. 0.05 + Piecewise[{{(((3.95)*(1 - Cos[2 Pi Mod[t, 1]/period])/2) +
  9. EVLtr2)/2, Mod[t, 1] < 0.3}}];
  10.  
  11.  
  12.  
  13. EATtr =
  14. 0.17 + Piecewise[{{0.73 (1 - Cos[2 Pi Mod[t - 0.9, 1]/0.1])/2,
  15. Mod[t, 1] > 0.9}}];
  16. EPATtr =
  17. 0.2 + Piecewise[{{0.5 (1 - Cos[2 Pi Mod[t - 0.9, 1]/0.1])/2,
  18. Mod[t, 1] > 0.9}}];
  19. EPVLtr =
  20. 0.08 + Piecewise[{{3.95/5 (1 - Cos[(2 Pi Mod[t, 1]/0.3)])/2,
  21. Mod[t, 1] < 0.3}}];
  22.  
  23.  
  24.  
  25. {Plot[Originalfunc, {t, t0, t1}],
  26. Plot[{Originalfunc, ToBeAddedfunction, Combinedfunction}, {t, t0,
  27. t1}, PlotRange -> All,
  28. PlotLegends -> {"Originalfunc", "ToBeAddedfunction",
  29. "Combinedfunction"}],
  30. Plot[{Originalfunc, EATtr, EPATtr, EPVLtr, Combinedfunction}, {t,
  31. t0, t1}, PlotRange -> All,
  32. PlotLegends -> {"EVL", "EAT", "EPAT", "EPVL", "Enew"}]}]
  33.  
  34. Manipulate[
  35. Manipulatedelastance[t0, t1, tdelay, period], {{t0, 0}, 0,
  36. 30}, {{t1, 2}, 0, 20}, {{tdelay, 0.7}, 0, 1}, {{period, 0.3}, 0, 1}]
  37.  
  38. OriginalFn[t_] := 0.05 + 3.95 Piecewise[{{1/2 (1 - Cos[2 Pi Mod[t, 1]/0.3]), Mod[t, 1] < 0.3}}]
  39.  
  40. ToBeAddedFn[t_, delay_, period_, amplitude_] := amplitude *
  41. Piecewise[{
  42. {1/2 (1 - Cos[2 Pi Mod[t - delay, 1]/period]), Mod[t - delay, 1] < period}
  43. }]
  44.  
  45. Manipulate[
  46. Row[{
  47. Plot[{OriginalFn[t], ToBeAddedFn[t, delay, period, amplitude]}, {t, 0, 0.4}, PlotRange -> {0.0, 4}, ImageSize -> 300],
  48. Plot[1/2 (OriginalFn[t] + ToBeAddedFn[t, delay, period, amplitude]), {t, 0, 0.4}, PlotRange -> All, ImageSize -> 300]
  49. }],
  50. {{period, 0.2}, 0.015, 0.3},
  51. {{delay, 0.003}, 0, 0.3 - period},
  52. {{amplitude, 1.97}, 0, 8}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement