⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 generator_white_noise.m

📁 This program generates a input signal and a desired signal of the idetification plant
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                                         %
%  This program generates a input signal and a desired signal of the idetification plant  %
%                %
%                                                                                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [x,d,num]=generator_white_noise(K,snr,N,Fc);
%[x,d,num]=generator_white_noise(5000,40,32,0.5);
%[x,d,num]=generator_white_noise(5000,20,32,0.5);
%[x,d,num]=generator_white_noise(5000,15,32,0.5);

%----------------------------------------------------%
% Input parameters:
%            K    :   the length of the signal
%            N    :   the order plus 1
%            snr  :   ratio of the input signal to noise signal
%            Fc   :   the 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,Fc);                                          %  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 + -