image thumbnail

EXPO 2011 Signal Processing Workflow Demo Files

by

 

MATLAB EXPO 2011 Signal Processing Workflow Demo Files

wkf_filtfxpt.m
%% tB^̌Œ菬_f
% ̃fł́Amb`tB^̌Œ菬_s
% vZXЉ܂B
% gpIvVFSignal Processing Toolbox, DSP System Toolbox
% Fixed-Point Toolbox
%%
clear all, close all		% 

Fd1  = fdesign.notch('N,F0,BW,Ast',2,peak_freq(1)/(Fs/2),500/(Fs/2),30);
designmethods(Fd1)
Hd1 = design(Fd1);
Fd2  = fdesign.notch('N,F0,BW,Ast',2,peak_freq(3)/(Fs/2),500/(Fs/2),30);
designmethods(Fd2)
Hd2 = design(Fd2);

Hd = cascade(Hd1, Hd2)
hfv = fvtool(Hd,'Fs',Fs)

%% tB^\̐ݒ
Hd1df1 = design(Fd1,'FilterStructure','df1sos')
Hd1df2 = design(Fd1,'FilterStructure','df2sos')

Hd1df1.Arithmetic = 'fixed'
Hd1df2.Arithmetic = 'fixed'


%% o̓rbg̕ύX
Hd1df1.InputWordLength = 24;
Hd1df1.OutputWordLength = 24;
Hd1df1.NumStateWordLength = 24;
Hd1df1.DenStateWordLength = 24;

Hd1df2.InputWordLength = 24;
Hd1df2.OutputWordLength = 24;
Hd1df2.StateWordLength = 24;
Hd1df2.SectionInputWordLength = 24;

%% o͓܂߂g
h0 = fvtool(Hd1df1,Hd1df2,'magestimate')	% U
legend(h0,'DF1SOS','DF2SOS')
%% I[o[t[̂߂ɃI[gXP[O
x1 = -2+4*rand(100,10);	% (-2 2)
Hd1df1a = autoscale(Hd1df1,x1)
Hd1df2a = autoscale(Hd1df2,x1)

h1 = fvtool(Hd1df1a,Hd1df2a,'magestimate')	% U
legend(h1,'DF1SOS','DF2SOS')
% h1 = fvtool(Hd12,Hd22,'magestimate')	% U
% realizemdl(Hd1df1a)
% realizemdl(Hd1df2a)

%% mCYp[̑
% FreqRange = [0 0.24];
% FreqRange = [Fd1.F0-Fd1.BW  Fd1.F0+Fd1.BW];
FreqRange = [0.3 1];
df1noise = noisepsd(Hd1df1a,100);
df1_avg_noisepwr = db(avgpower(df1noise,FreqRange*pi),'power')
df2noise = noisepsd(Hd1df2a,100);
df2_avg_noisepwr = db(avgpower(df2noise,FreqRange*pi),'power')

h2 = fvtool(Hd1df1a, Hd1df2a,'noisepower')
legend(h2,'DF1SOS','DF2SOS')
% df1sos -132.4835  -129.6988  -136.6313
% df2sos -130.8535  -137.2393  -125.9112
% ʉߑшɂĂdf1sos^̂قmCYp[ǂ

%% Fd2Œ菬_
Hd2df1 = design(Fd2,'FilterStructure','df1sos')
Hd2df1.Arithmetic = 'fixed'
Hd2df1.InputWordLength = 24;
Hd2df1.OutputWordLength = 24;
Hd2df1.NumStateWordLength = 24;
Hd2df1.DenStateWordLength = 24;

Hd2df1a = autoscale(Hd2df1,x1)

h3 = fvtool(Hd1df1a,Hd2df1a,'magestimate')	% U
legend(h3,'DF1SOS','DF2SOS')
% info(Hd1)	% ڍ׏

%% ~bgTCNŨeJV~[V
greport1 = limitcycle(Hd1df1a,20,2,'granular')
oreport1 = limitcycle(Hd1df1a,20,2,'overflow')
figure
subplot(2,1,1)
plot(greport1.Output(1:20)), title('Granular Limit Cycle');
subplot(2,1,2)
plot(oreport1.Output(1:20)), title('Overflow Limit Cycle');

%% JXP[hڑ
Hdd2 = cascade(Hd1df1a,Hd2df1a);
h2 = fvtool(Hdd2,'magestimate')	% U


%% SimulinkubN̎ 
open_system('sim_notch')
realizemdl(Hdd2)

%%

Contact us