"Prashant Sandhi" wrote in message <jq773p$47u$
1...@newscl01ah.mathworks.com>...
Hallo There,
I have found a way to read the filter coefficients and write into an excel sheet.
Here it is how I have done:
*****************************************************************
clear all;clc;
Data=inputdlg( {'Enter IWL:','Enter CWL:'})
IWL = str2num(Data{1}); % Enter Input Word Length
CWL = str2num(Data{2}); % Enter Coefficient Word Length
Fs = 2.677; % Sampling Frequency
N = 424; % Order
Fc = 0.1; % Cutoff Frequency
flag = 'scale'; % Sampling Flag
% Create the window vector for the design algorithm.
win = rectwin(N+1);
% Calculate the coefficients using the FIR1 function.
b = fir1(N, Fc/(Fs/2), 'low', win, flag);
Hd = dfilt.dffir(b);
% Set the arithmetic property.
set(Hd, 'Arithmetic', 'fixed', ...
'CoeffWordLength', CWL, ...
'CoeffAutoScale', true, ...
'Signed', true, ...
'InputWordLength', IWL, ...
'inputFracLength', 0, ...
'FilterInternals', 'FullPrecision');
denormalize(Hd);
read_coefficients = Hd.coeffs; %read_coefficients is structure type
class(read_coefficients);
conv_coefficients_CELL=struct2cell(read_coefficients);
conv_coefficients_MAT=cell2mat(conv_coefficients_CELL);
xlswrite('Sinc_Filter_Coefficients.xls', (conv_coefficients_MAT*2^IWL)');
COEFFICIENTS = (conv_coefficients_MAT*2^IWL)';
fvtool(Hd,'Analysis','freq');figure(gcf)
open ('Sinc_Filter_Coefficients.xls')
**************************************************************
Point that is missing now is how to realize the simulink block for this above filter?
Any idea there?