simple_signal.m

来自「很多matlab的源代码」· M 代码 · 共 37 行

M
37
字号
figure('position',[10 10 800 500],...
    'name','基本序列的表示');
n=[0:10];
n0=3
x= [(n-n0) == 0];
subplot(2,1,1);
h=stem(n,x);
set(h,'LineWidth',2);
set(h,'MarkerSize',2);
xlabel('n');ylabel('x(n)')
title('单位样本序列')
Hc_close=uicontrol(gcf,'style','push',...%
'position',[650 40 100 25],...        % 
'string','Close',...                 %
'Callback','Close');                 %以上四行代码是产生close按键   
h1=uicontrol('style','popupmenu','string','单位样本序列|单位阶跃序列|实指数序列|复数指数序列|正弦序列|随即序列|周期序列',...
'position',[550 140 200 20]);
we1 = {'单位样本序列'
       'δ(n) = 1  n=0'
       'δ(n) =0  n≠0'
       'function[x,n]=impseq(n0,n1,n2)'
       '%Generates x(n)=delta(n-n0);'
       '               n1 <= n <= n2'
       '%--------------------------------------'
       '%[x,n]=impseq(n0,n1,n2)'
       '%'
       'n= [n1:n2]; x= [(n-n0) == 0;]'
       ''
       '例:'
       'n1=0'
       'n2=10'
       'n=3| '};
h2=uicontrol('style','listbox','FontWeight','demi','position',[20 20 500 150],...
'string',we1,...
'max',2);
h3=uicontrol('style','text','position',[20 170 40 14],'FontWeight','demi','string','说明')
set(h1,'Callback','simple_signal_sub');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?