?? generator_color_noise.m
字號:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% This program generates a color signal as the input signal and a desired signal of the idetification plant %
% on Nov 11,2007 %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [x,d,num]=generator_color_noise(K,snr,N,Fa,Fb);
%[x,d,num]=generator_color_noise(10000,25,512,0.35,0.65);
%----------------------------------------------------%
% Input parameters:
% K : the length of the signal
% N : the order plus 1
% snr : ratio of the input signal to noise signal
% Fa : the low cut-off frequency of the plant
% Fb : the up cut-off frequency of the plant
%----------------------------------------------------%
%---------------initialization-----------------------%
x=randn(1,K); % generate a random signal as input signal
d=zeros(1,K); % define the desired signal
%-----------signal generation------------------------%
num=fir1(N-1,[Fa Fb]); % generate the numerator of the transforing function
den=[1]; % generate the denominator of the transforing function
d=filter(num,den,x); % get the desired signal by filtering the input signal
d=awgn(d,snr); % add the noise signal to the desired ignal
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -