Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %widmo amplitudowe, fazowe, przeciek, aliasing
- %dla sumy dwoch sygnalow sinusoidalnych o częst f1 i f2
- clear all; clg; subplot(111);
- fs = 2000;
- N = 1000;
- Ts = 1/fs;
- t = 0:Ts:(N-1)*Ts;
- f1 = 141;
- f2 = 380.5;
- A1 = 2;
- A2 = 1;
- x1 = A1*sin(2*pi*f1*t); %2 sin
- x2 = A2*sin(2*pi*f2*t); %1 sin
- x = x1+x2; %sygnal
- x = x.*hanning(length(x))'; %sygnal okienkowany (Hanning)
- subplot(3,1,1);
- plot(t, x); grid on;
- title('Sygnal');
- xlabel('Sekundy');
- ylabel('x(n)');
- X = abs(fft(x)); %widmo amplitudowe
- deltaf = fs/N %rozdzielczosc widma
- disp(['Rozdzielczosc widma w Hz: ',num2str(deltaf)]);
- f=0:deltaf:fs-deltaf; %wektor czestotliwosci
- subplot(3,1,2);
- stem(f,X,'.');
- grid on;
- subplot(3,1,3);
- stem(f(1:250),X(1:250));
- grid on;
- title(['widmo amplitudowe, rozdzielczosc widma =',num2str(deltaf),'Hz']);
- xlabel('czestotliwosc w Hz');
- ylabel('X(m)');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement