Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fs = 20;
- Ts = 1/fs
- L = 10- Ts;
- t = 0:Ts:L;
- f = zeros(1,200);
- f(1:100) = 2;
- f(101:200) = 5;
- signal = sin(2*pi*f.*t);
- N = length(signal);
- XRozsah = abs(fftshift(fft(signal)));
- BinOsa = [0 : N-1];
- N_2 = ceil(N/2);
- FOsa= (BinOsa-N_2)*fs/N;
- title("Graf")
- subplot(2,1,1)
- plot(FOsa, XRozsah)
- xlabel('Frekvence(Hz)');
- ylabel('Rozsah');
- title('Dvoustranne frekvensni spektrum');
- axis tight
- subplot(2,1,2)
- plot(t,signal)
- xlabel('Cas');
- ylabel('Amplituda');
- title("Casova oblast")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement