examp21.m

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

M
12
字号

clc,echo on 
%EXAMPLE 21 
n=0:199;                                 % Create a DT index 
x=sin(2*pi*n*0.025); x=x(:);             % 1 Hz sine sampled at 40 Hz 
xn=x+0.5*randist(x,'uni');               % Add (uniform) random noise 
a=[1 zeros(1,19)]; b=0.05*ones(1,20);    % Coefficient arrays of MA filter
y=filter(b, a, xn);                      % Response using filter
plot(n,x);pause(2)                       % Plot input
plot(n,xn,n,y);                          % Noisy input and smoothed output 
echo off %end of example

⌨️ 快捷键说明

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