📄 jieduan.m
字号:
% 《数字信号处理教程——MATLAB释义与实现》第四章截断效应演示程序
% 电子工业出版社出版 陈怀琛编著 2004年9月
% 同时演示采样频率小于2*fc时,产生的混叠效应
%
% jieduan1.m 演示对直流信号进行截断后,信号频谱的变化,
% 在演示程序中,图形的计算是由已知的时域和频域表达式计算
clf reset
set(gcf,'unit','normalized','position',[0.1,0.2,0.5,0.5]);
set(gcf,'defaultuicontrolunits','normalized');
h_axes1=axes('position',[0.1,0.6,0.6,0.3]);
set(h_axes1,'xlim',[-10,10],'ylim',[0,1.5]);
h1=plot([-10,10],[1,1],'color','r','linestyle','-.');hold on
h2=plot([0,0],[0,1.5],'color','r');
t=5;
plot([t t],[0 1]);plot([-t -t],[0,1]);plot([-t t],[1 1]);
h_axes2=axes('position',[0.1,0.1,0.6,0.3]);
set(h_axes2,'xlim',[-5,5]);
w=-5:0.1:5; %t=5;
for i=1:length(w)
if w(i)==0
y(i)=1;
else
y(i)=sin(w(i)*t)/(w(i)*t); %表达式存在问题,应该为2*sin(w(i)*t)/(w(i));
end
end
plot(w,y);hold on;
hslider=uicontrol('style','slider',...
'position',[0.2,0.5,0.4,0.05],...
'max',10,'min',0,...
'sliderstep',[0.01,0.05],...
'value',5);
set(hslider, 'CallBack',...
[ 'z = get(hslider,''Value'');'...
'call(h_axes2,z);',...
'call1(h_axes1,z);']);
htext1=uicontrol('style','text',...
'position',[0.2,0.45,0.02,0.03],...
'string','0');
htext2=uicontrol('style','text',...
'position',[0.57,0.45,0.03,0.03],...
'string','10');
htext3=uicontrol('style','text',...
'position',[0.72,0.6,0.15,0.2],...
'backgroundcolor','white',...
'fontsize',10,...
'string','滑动滑块,改变z,使得: x = 1 |t|<z; x = 0 |t|>z');
htext4=uicontrol('style','text',...
'position',[0.72,0.1,0.15,0.2],...
'backgroundcolor','white',...
'string','X=sinc(w*z)');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -