Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc; clear; close all;
- f1= 8;
- N=4;
- M=2;
- t1=-0.5:1/(f1*16):0.5;
- sin1= sin(2*pi*f1.*t1),
- sin2=zeros(1,length(sin1)*N),
- sin2(1:N:length(sin2))=sin1;
- sin3=sin1(1:M:length(sin1));
- t1= linspace(-0.5,0.5,length(sin1))
- t2= linspace(-0.5,0.5,length(sin2))
- t3= linspace(-0.5,0.5,length(sin3))
- B1= fir1(20,1/(2*N));
- B2= fir1(20,1/(2*M));
- sinf2=filter(B1,1,sin2);
- sinf3=filter(B2,1,sin3);
- dft1=fft(sin1),
- dft2=fft(sinf2),
- dft3=fft(sinf3),
- figure(1);
- subplot(2,1,1)
- plot(t1, sin1,'.-'); hold on; plot(t2,sinf2,'.');
- subplot(2,1,2)
- plot(t1, sin1,'.-'); hold on; plot(t3,sinf3,'o');
- figure(2);
- subplot(3,1,1)
- plot(abs(dft1));
- subplot(3,1,2)
- plot(abs(dft2));
- subplot(3,1,3)
- plot(abs(dft3));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement