Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fs = 800; % Częstotliwości próbkowania
- Ts = 1/Fs; % Czas próbkowania
- L = 48; % Liczba próbek
- t_d = (0:L-1)*Ts; % Oś czasu - wartości dyskretne
- t_c = linspace(t_d(1),t_d(end),100); % Oś czasu - wartości ciągłe
- A = 10; % Parametry sygnały - Amplituda
- f = 50; % Parametry sygnały - Częstotliwości
- Phi = 0; % Parametry sygnały - Przesunięcie fazowe
- y_d = A*sin(2*pi*f*t_d + Phi); % Sygnał - wartości osi Y
- % Wykres
- figure
- set(gcf,'DefaultLineLineWidth',2);
- set(gcf,'DefaultAxesFontSize',14);
- hold on;
- stem(t_d,y_d,'s')
- hold off
- grid on
- xlabel('Czas[s]')
- ylabel('Amplituda')
- legend('- d -')
- % DFT
- Y = fft(y_d);
- Y = abs(Y)/L;
- Y(2:end-1) = 2*Y(2:end-1);
- f = Fs*(0:(L))/L;
- % Wykres
- figure
- set(gcf,'DefaultLineLineWidth',1);
- set(gcf,'DefaultAxesFontSize',14);
- stem(f(1:L/2+1),Y(1:L/2+1),'s','LineWidth',2)
- grid on
- xlabel('f[Hz]')
- ylabel('Amplituda')
- legend('- d -')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement