Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%Time specifications:
- Fs = 120; % samples per second
- dt = 1/Fs; % seconds per sample
- StopTime = 1; % seconds
- t = (0:dt:StopTime-dt)';
- N = size(t,1);
- %%Sine wave:
- Fc1 = 40;
- Fc2 = 120; % hertz
- x = 2*cos(2*pi*Fc1*t) + sin(2*pi*Fc2*t) ;
- %%Fourier Transform:
- X = fftshift(fft(x));
- %%Frequency specifications:
- dF = Fs/N; % hertz
- f = -Fs/2:dF:Fs/2-dF; % hertz
- %%Plot the spectrum:
- figure;
- plot(f,abs(X)/N);
- xlabel('Frequency (in hertz)');
- title('Magnitude Response');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement