Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. xf = With[{
  2. i = Function[{t0, t1, x0, x1},
  3. Evaluate@
  4. Integrate[(x0 + (x1 - x0)/(t1 - t0) *(t - t0))*
  5. Exp[-2*Pi*I*f*t], {t, t0, t1}]]},
  6. Compile[{{f, _Real}, {t, _Real, 1}, {x, _Real, 1}} ,
  7. Total@i[Most[t], Rest[t], Most[x], Rest[x]]]
  8. ];
  9.  
  10. LogPlot[{Abs@xf[f, funX, fun1], Abs@xf[f, funX, fun2],
  11. Abs@xf[f/a, funX, fun2]/a}, {f, -50, 50}, PlotRange -> All, Frame -> True,
  12. FrameLabel -> {"Frequency [Hz]", "Amplitude", "Amplitude spectrum"},
  13. PlotLegends -> {"Original signal", "Time scaled"},
  14. ImageSize -> Large, PlotStyle -> {Red, Blue, Green}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement