% ask for a music signal spectrum
[Y,fs]=audioread (' gem.wav '); % read in a music signal
Plot (Y); % display of music original music waveform
Sound (Y,FS)% play music (at the original frequency) change FS can change the playback frequency
Y1=y (:, 1); % dual channel becomes single lane
Size (Y1)
Figure
Subplot (2,1,1);
Plot (Y); % Display Original signal waveform
N=length (Y1);
F1=fft (Y1); % Fourier transform
W=2/N*[0:N/2-1];
Subplot (2,1,2);
Plot (W,abs (F1 (1:N/2))); % Display waveform
Clear
[X,fs]=audioread (' gem.wav '); % FS Sample Frequency
% T = 1/fs; % Sample Time
L = length (x); % signal length
% T = (0:l-1) *t; % Time Vector
Nfft = 2^nextpow2 (L); % calculated Nextpow2 (l) =18 2^18=262144 slightly greater than L
X = FFT (X,NFFT)/L;
f = fs/2*linspace (0,1,NFFT/2); %linspace (0,1,m) means dividing between 0 and 1 evenly into m parts.
Plot (F,2*abs (X (1:NFFT/2)))
Title (' Y (t) single-sided amplitude spectrum ')
Xlabel (' Frequency (Hz) ')
Ylabel (' | Y (f) | ')
Technical White, write a program about MATLAB about the Fourier transform, to show a novice like me to learn a year of signal and system or do not know what is the use of Fourier transform, what is the point? I hope this program is helpful to others.
This article is from the "9188727" blog, please be sure to keep this source http://9198727.blog.51cto.com/9188727/1588103
How to find a music signal Fourier transform