Skip to content

Instantly share code, notes, and snippets.

@GiovanniBalestrieri
Created August 3, 2015 21:27
Show Gist options
  • Save GiovanniBalestrieri/ef3f05507753121d4220 to your computer and use it in GitHub Desktop.
Save GiovanniBalestrieri/ef3f05507753121d4220 to your computer and use it in GitHub Desktop.
Snippet - Basic Matlab Filter
%% Analyze signal
% Plots magnitude spectrum of the signal
X_mags=abs(fft(y));
figure(2)
plot(X_mags);
xlabel('DFT Bins');
ylabel('Magnitude');
% Plots first half of DFT (normalized frequency)
num_bins = length(X_mags);
plot([0:1/(num_bins/2 -1):1],X_mags(1:num_bins/2))
xlabel('Normalized frequency [\pi rads/samples]');
ylabel('Magnitude');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment