examp11.m

来自「ADSP TOOLBOX: Version 2.0 and gui m-file」· M 代码 · 共 17 行

M
17
字号

clc,echo on 
%EXAMPLE 11 
n=0:15;                                     % DT index 
x=uramp(n)-uramp(n-5)-5*uramp(n-10);        % Generate x[n] 
e=sum(x.*x)                                 % Energy in x[n]
dtplot(n,x,'o'),pause(2)                    % Plot x[n] using dtplot
xd=uramp(n-2)-uramp(n-7)-5*uramp(n-12);     % Generate x[n-2] 
stem(n,xd),pause(2)                         % Plot x[n-2] using stem
[xe,xo,nn]=evenodd(x,n);                    % Even, odd parts and index nn 
dtplot(nn,xe,'o'),pause(2)                  % Plot even part of x[n] 
dtplot(nn,xo,'o'),pause(2)                  % Plot odd part of x[n]
y=perext(x,7);                              % Periodic extension xpe[n] 
np=0:20;dtplot(np,[y y y],'o')              % Plot 3 periods over n=0:20
pwr=sum(y.*y)/7                             % Power in xpe[n]
echo off %end of example

⌨️ 快捷键说明

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