Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- [x,fpx] = audioread('mbi04czap.wav');
- Nx=length(x);
- tx=0:1/fpx:(Nx-1)/fpx;
- subplot(2,2,1);
- plot(tx,x);
- xlabel('czas[s]');
- ylabel('x(t)');
- title('sygnal org');
- Nfx = 2^11;
- Nfx21=Nfx/2+1;
- v=fft(x,Nfx);
- wx=abs(v);
- fx=linspace(0,fpx/2,Nfx21);
- subplot(2,2,2);
- plot(fx, wx(1:Nfx21));
- xlabel('czest [Hz]');
- ylabel('|X(f)|');
- title('modul widma sygnalu org');
- dr=3;
- Ny=floor(Nx/dr);
- %pierwszy sposob
- %for i=1:Ny
- % y(i)=x((i-1)*dr+1);
- %end
- %drugi sposob
- y=decimate(x,dr);
- Ny=length(y);
- fpy=fpx/dr;
- ty=0:1/fpy:(Ny-1)/fpy;
- subplot(2,2,3);
- plot(ty,y);
- xlabel('czas[s]');
- ylabel('y(t)');
- title('sygnal po decymacji');
- Nfy = 2^14;
- Nfy21=Nfy/2+1;
- v=fft(y,Nfy);
- wy=abs(v);
- fy=linspace(0,fpy/2,Nfy21);
- subplot(2,2,4);
- plot(fy, wy(1:Nfy21));
- xlabel('czest [Hz]');
- ylabel('|Y(f)|');
- title('modul widma sygnalu po decymacji');
- _____________________________________________
- clear all;
- N=4000;
- fp=10000;
- t=0:1/fp:(N-1)/fp;
- x= sin(2*pi*t*740)+sin(2*pi*370*t);
- subplot(3,3,1);
- plot(t,x);
- xlabel('czas [s]');
- ylabel('x(t)');
- title('sinusoida');
- kmax=100;
- rx=xcorr(x,x,kmax);
- tr=-kmax/fp:1/fp:kmax/fp;
- subplot(3,3,2);
- plot(tr,rx);
- xlabel('przesuniecie [s]');
- ylabel('autokorelacja x(t)');
- y=randn(1,N);
- subplot(3,3,4);
- plot(t,y);
- xlabel('czas [s]');
- ylabel('y(t)');
- title('szum naturalny');
- ry=xcorr(y,y,kmax);
- subplot(3,3,5);
- plot(tr,ry);
- xlabel('przesuniecie [s]');
- ylabel('autokorelacja y(t)');
- z=rand(1,N);
- subplot(3,3,7);
- plot(t,z);
- xlabel('czas [s]');
- ylabel('z(t)');
- title('szum jednorodny');
- rz=xcorr(z,z,kmax);
- subplot(3,3,8);
- plot(tr,rz);
- xlabel('przesuniecie [s]');
- ylabel('autokorelacja z(t)');
- nbins=21;
- subplot(3,3,3);
- hist(x,nbins);
- xlabel('wart. probki ');
- ylabel('ilosc probek');
- title('histogram x(t)');
- subplot(3,3,6);
- hist(y,nbins);
- xlabel('wart. probki ');
- ylabel('ilosc probek');
- title('histogram y(t)');
- subplot(3,3,9);
- hist(z,nbins);
- xlabel('wart. probki ');
- ylabel('ilosc probek');
- title('histogram z(t)');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement