From: david t53 on
I am using matlab's filter function using their Fixed Point library. Is there a way to log *all* fixed-point operations? (not only overflows, but all fixed-point operations)

Thanks,
David
From: Steven Lord on

"david t53" <david_t53(a)sogetthis.com> wrote in message
news:hvijs9$fln$1(a)fred.mathworks.com...
>I am using matlab's filter function using their Fixed Point library. Is
>there a way to log *all* fixed-point operations? (not only overflows, but
>all fixed-point operations)

Why? What do you want to do with this information?

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: david t53 on
> Why? What do you want to do with this information?

Because we have implemented the same alg in C,
in we do not get the same result,
so we need to understand to exact operations are being done.
From: Steven Lord on

"david t53" <david_t53(a)sogetthis.com> wrote in message
news:i0agit$qg4$1(a)fred.mathworks.com...
>> Why? What do you want to do with this information?
>
> Because we have implemented the same alg in C,
> in we do not get the same result,
> so we need to understand to exact operations are being done.

Okay, that sounds like you should step through the fixed-point code using
the Debugger in MATLAB while stepping through your C code using the C
debugger, and compare the results at each step until you determine where the
results diverge. Once you've figured out where the results start to
diverge, you can investigate why (and ask for help from Technical Support if
necessary or if you believe there's a bug in the Fixed-Point Toolbox code.)

If you're not familiar with how the debugging tools work in MATLAB, read
through the "Finding Errors, Debugging, and Correcting MATLAB Files" section
of this chapter in the documentation:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f2-4931.html

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: david t53 on
Thanks for your answer.

However, the problem is that calling dfilt.filter eventually calls
/Applications/MATLAB_R2009b.app/toolbox/filterdesign/quantization/\@quantum/\@fixeddf2sosfilterq/df2sosfilter.m

which calls a DLL:
fidf2sosfilter(coeffStruct,sStruct,mathStruct,x,y);

where the source code is not available, I think, and it cannot be debugged in MATLAB.

Thus, if I have the following filter:
h = fdesign.lowpass('fp,fst,ap,ast', 0.45, 0.55, 1, 60);
Hd = design(h, 'butter', 'MatchExactly', 'stopband');
set(Hd, 'Arithmetic', 'fixed', 'InputWordLength', 16, 'InputFracLength', 15, 'CoeffWordLength', 16...
y = filter(Hd, x);
I cannot compare the intermediate results step by step between matlab and my c code,
so I don't know where it starts to diverge.


---
Thus, is there a way to log *all* fixed-point operations when calling y = filter(Hd, x) (even the ones executed in the matlab fidf2sosfilter DLL)?
(not only overflows, but all fixed-point operations)


Regards,
David