This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/Matlab/comm/lab1_0.m

15 lines
530 B
Mathematica
Raw Normal View History

2022-10-30 06:12:40 +00:00
Fs=1e4;N=1e4; %FFT
t=(0:N-1)/Fs; %
f=Fs*(-N/2:N/2-1)/N; % f
ft=200*(sinc(200*(t-0.6))).^2; %
yt=ft.*cos(2000*pi*t);
F=fftshift(fft(yt,N))/N; %
AF=abs(F); %
AFdB=20*log10(AF); %/dB
subplot(311);plot(t,yt);
xlabel('t/s');grid on
axis([0.55,0.65,-10,210])
subplot(312);plot(f,AF);
ylabel('');xlabel('f/Hz');grid on
subplot(313);plot(f,AFdB);
ylabel('/dB');xlabel('f/Hz');grid on