Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fs = 10000; % Sampling frequency
- T = 1/Fs; % Sampling period
- L = 10000; % Length of signal
- t = (0:L-1)*T; % Time vector
- simples = zeros(size(t,2),3);
- simples(:,1) = 0.7*sin(2*pi*50*t);
- simples(:,2) = sin(2*pi*120*t);
- simples(:,3) = 2*sin(2*pi*250*t);
- S = (simples(:,1) + simples(:,2) + simples(:,3)).'; %Source signal
- plot(1000*t(1:250),simples(1:250))
- title('Source Signal')
- xlabel('t (milliseconds)')
- ylabel('S(t)')
- X = S + 2*randn(size(t)); %Source signla + Noise
- plot(1000*t(1:500),simples(1:500,:))
- title('Signal + Noise')
- xlabel('t (milliseconds)')
- ylabel('X(t)')
- Y = fft(X);
- P2 = abs(Y/L);
- P1 = P2(1:L/2+1);
- P1(2:end-1) = 2*P1(2:end-1);
- f = Fs*(0:(L/2))/L;
- plot(f(1:500),P1(1:500))
- title('Single-Sided Amplitude Spectrum of X(t)')
- xlabel('f (Hz)')
- ylabel('|P1(f)|')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement