Advertisement
xXx_Fortis_xXx

Untitled

Jun 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.20 KB | None | 0 0
  1. function foo (x, arr, T)
  2.     n = length(arr);
  3.     y = zeros(1, length(x)) + arr(1) / 2;
  4.     t = 1;
  5.     for k = [2:n]
  6.         t /= 2;
  7.         y += arr(k) * t * cos(2 * pi * k * x / T);
  8.     end
  9.     figure();
  10.     plot(x, y);
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement