?? 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 + -