Skip to content

Instantly share code, notes, and snippets.

@matthinc
Created June 22, 2019 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthinc/ce40c8eab7424f9f4ccc47ce418a1384 to your computer and use it in GitHub Desktop.
Save matthinc/ce40c8eab7424f9f4ccc47ce418a1384 to your computer and use it in GitHub Desktop.
fourier_function = @(x, k) (2./(pi .^2)) * (1./(k.^2)) * (((-1).^k)-1);
test_range = 0:0.1:10;
k_range = 1:10;
fourier_values = zeros(size(test_range));
for k = k_range
values = fourier_function(test_range, k) .* e.^(i * k * test_range);
fourier_values = fourier_values + values;
end
plot(test_range, fourier_values);
input("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment