Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all
- fs=1000 % sample frequency 1000hz
- nDFT=128 %128 point sample
- t = 0:1/fs:(nDFT)*(1/fs)
- x = 3*sin(80*pi*t) + sin(160*pi*t)
- subplot(2,1,1)
- stem(t,x,'.')
- xlabel('t')
- ylabel('x(t)')
- y=fft(x)
- y=fftshift(y)
- f=-fs/2:fs/nDFT:fs/2
- subplot(2,1,2)
- stem(f,abs(y),'.')
- xlabel('freq')
- saveas(gcf,'ex1.png')
- sampled_signal = fopen('sampled_signal.bin','w')
- fwrite(sampled_signal,x,'double')
- fclose(sampled_signal)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement