?? sinc2.m
字號:
clear
%初始相位為0
fc=100;%sin信號的頻率
a=-0.02;
b=0.02;
dt=1/1000;
t=a:dt:b;
fc1=fc*2;%臨界采樣頻率,即每個sin周期取樣2個點
ts1=1/fc1;%臨界采樣的時間間隔
t1=a:ts1:b;
x1=cos(2*pi*fc*t1);
y1=0;
for i=1:length(x1)
y1=y1+x1(i)*sinc((t-t1(i))/ts1);
end
fc2=fc*1.5;%欠采樣頻率,即每個sin周期取樣1.5個點
ts2=1/fc2;%欠采樣的時間間隔
t2=a:ts2:b;
x2=cos(2*pi*fc*t2);
y2=0;
for i=1:length(x2)
y2=y2+x2(i)*sinc((t-t2(i))/ts2);
end
fc3=fc*8;%欠采樣頻率,即每個sin周期取樣8個點
ts3=1/fc3;%欠采樣的時間間隔
t3=a:ts3:b;
x3=cos(2*pi*fc*t3);
y3=0;
for i=1:length(x3)
y3=y3+x3(i)*sinc((t-t3(i))/ts3);
end
figure
subplot(3,1,1)
plot(t,cos(2*pi*fc*t))
subplot(3,1,2)
stem(t1,x1)
subplot(3,1,3)
plot(t,y1)
figure
subplot(3,1,1)
plot(t,cos(2*pi*fc*t),'*black')
subplot(3,1,2)
stem(t2,x2)
subplot(3,1,3)
plot(t,y2)
figure
subplot(3,1,1)
plot(t,cos(2*pi*fc*t))
subplot(3,1,2)
stem(t3,x3)
subplot(3,1,3)
plot(t,y3)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -