Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. ClearAll[f, g, h];
  2. f[x_] := Piecewise[{{3, 0 < x < 1}, {-3, 1 < x < 2}}]
  3. g[x_] := f[Mod[x, 2]]
  4. h[x_] = FourierSeries[g[x], x, 30];
  5. Show[
  6. Plot[g[x], {x, -1, 3}, Filling -> Axis],
  7. Plot[h[x], {x, -1, 3}],
  8. PlotRange -> {-4, 4}
  9. ]
  10.  
  11. ClearAll[f, g, h, k];
  12. f[x_] := Piecewise[{{3, 0 < x < 1}, {-3, 1 < x < 2}}]
  13. g[x_] := f[Mod[x, 2]]
  14. h[x_] = FourierSeries[g[x], x, 30];
  15. k[x_] = FourierTrigSeries[g[x], x, 30];
  16. Show[
  17. Plot[g[x], {x, -1, 3}, Filling -> Axis],
  18. Plot[h[x], {x, -1, 3}],
  19. Plot[k[x], {x, -1, 3}],
  20. PlotRange -> {-4, 4}
  21. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement