DSPRelated.com
Forums

using fdatool and cmsis

Started by Vl4ever January 14, 2012
On Tue, 17 Jan 2012 01:36:01 -0800, Mac Decman
<dearman.mark@gmail.com> wrote:

>On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever" ><moikef@n_o_s_p_a_m.gmail.com> wrote: > >[snip] >>The problem is that either by exporting the coefficients (SOS form,Direct >>Form I ) to Matlab workspace or by generating C header file it is unclear >>to me which coefficients I should place in my API - I have 3 sections >>(stages) and I am required to give the coefficients in a form of : >> {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...} >>where b1x and a1x are the coefficients for the first stage, b2x and a2x are >[snip] >>So the question is how can I extract the coefficients either from Matlab >>workspace or from c header file ? >>Thank You >> >This whole post is kind of nut balls. I mean the guy has the manuals >for the API and for MATLAB at his disposal. IT is not hard to match >them up and make the application work. Unless the numbering is just >totally insane this should be plug and play from MATLAB. > >Mark DeArman
Hah, sorry I missed the gain coeff. change with his lack of a10 coeff. when I posted this. Again I read way too fast. I really will learn to read all of the post before I reply one day. Mark DeArman
>On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever" ><moikef@n_o_s_p_a_m.gmail.com> wrote: > >[snip] >>The problem is that either by exporting the coefficients (SOS
form,Direct
>>Form I ) to Matlab workspace or by generating C header file it is
unclear
>>to me which coefficients I should place in my API - I have 3 sections >>(stages) and I am required to give the coefficients in a form of : >> {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...} >>where b1x and a1x are the coefficients for the first stage, b2x and a2x
are
>[snip] >>So the question is how can I extract the coefficients either from Matlab >>workspace or from c header file ? >>Thank You >> >This whole post is kind of nut balls. I mean the guy has the manuals >for the API and for MATLAB at his disposal. IT is not hard to match >them up and make the application work. Unless the numbering is just >totally insane this should be plug and play from MATLAB. > >Mark DeArman >
I wish this was really plug and play ,as you say ,but ,unfortunately ,it is not .I came across several messages regarding the same subject - The generated C header was supposed to be crystal clear and easy to implement ,but is far from that. I also observe a lot of labs in DSP course in universities/college who use work around methods to extract those coefficients and i could continue on and on.If it was so easy , I wouldn't write this post from the beginning, so please focus on solving the issue ,and not saying how it is easy and how knoob I am.Saying the subject is easy will not make it any easier. Thank all for helpful responses,it helped a lot.Only one little thing left to figure out and I am good and ready to continue
On Tue, 17 Jan 2012 04:46:57 -0600, "Vl4ever"
<moikef@n_o_s_p_a_m.gmail.com> wrote:

>>On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever" >><moikef@n_o_s_p_a_m.gmail.com> wrote: >> >>[snip] >>>The problem is that either by exporting the coefficients (SOS >form,Direct >>>Form I ) to Matlab workspace or by generating C header file it is >unclear >>>to me which coefficients I should place in my API - I have 3 sections >>>(stages) and I am required to give the coefficients in a form of : >>> {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...} >>>where b1x and a1x are the coefficients for the first stage, b2x and a2x >are >>[snip] >>>So the question is how can I extract the coefficients either from Matlab >>>workspace or from c header file ? >>>Thank You >>> >>This whole post is kind of nut balls. I mean the guy has the manuals >>for the API and for MATLAB at his disposal. IT is not hard to match >>them up and make the application work. Unless the numbering is just >>totally insane this should be plug and play from MATLAB. >> >>Mark DeArman >> > > >I wish this was really plug and play ,as you say ,but ,unfortunately ,it is >not .I came across several messages regarding the same subject - The >generated C header was supposed to be crystal clear and easy to implement >,but is far from that. I also observe a lot of labs in DSP course in >universities/college who use work around methods to extract those >coefficients and i could continue on and on.If it was so easy , I wouldn't >write this post from the beginning, so please focus on solving the issue >,and not saying how it is easy and how knoob I am.Saying the subject is >easy will not make it any easier. >Thank all for helpful responses,it helped a lot.Only one little thing left >to figure out and I am good and ready to continue
Uhm jeez I hope you don't kill your self after that post... But I believe the one up there pointing to the rbj post might really help you.
On Tue, 17 Jan 2012 04:46:57 -0600, "Vl4ever"
<moikef@n_o_s_p_a_m.gmail.com> wrote:

>>On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever" >><moikef@n_o_s_p_a_m.gmail.com> wrote: >> >>[snip] >>>The problem is that either by exporting the coefficients (SOS >form,Direct >>>Form I ) to Matlab workspace or by generating C header file it is >unclear >>>to me which coefficients I should place in my API - I have 3 sections >>>(stages) and I am required to give the coefficients in a form of : >>> {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...} >>>where b1x and a1x are the coefficients for the first stage, b2x and a2x >are >>[snip] >>>So the question is how can I extract the coefficients either from Matlab >>>workspace or from c header file ? >>>Thank You >>> >>This whole post is kind of nut balls. I mean the guy has the manuals >>for the API and for MATLAB at his disposal. IT is not hard to match >>them up and make the application work. Unless the numbering is just >>totally insane this should be plug and play from MATLAB. >> >>Mark DeArman >> > > >I wish this was really plug and play ,as you say ,but ,unfortunately ,it is >not .
Yes it is. I can plug MATLAB into my program with ease... I just push the button.
>I came across several messages regarding the same subject - The >generated C header was supposed to be crystal clear and easy to implement >,but is far from that.
Not so... It is very easy if you read the documentation.
>I also observe a lot of labs in DSP course in >universities/college who use work around methods to extract those >coefficients and i could continue on and on.
Holy shit you are my worst nightmere at college!
>If it was so easy , I wouldn't >write this post from the beginning, so please focus on solving the issue >,and not saying how it is easy and how knoob I am
My god... I sure hope you are an undergrad or I'm going to kill myself later.
>.Saying the subject is >easy will not make it any easier.
Well why the fuck are you in college?
>Thank all for helpful responses,it helped a lot.Only one little thing left >to figure out and I am good and ready to continue
Your question is so stupid that my mind is blown? Please learn to ask questions and I would be happy to...
On Tue, 17 Jan 2012 03:13:41 -0800, Mac Decman
<dearman.mark@gmail.com> wrote:

>On Tue, 17 Jan 2012 04:46:57 -0600, "Vl4ever" ><moikef@n_o_s_p_a_m.gmail.com> wrote: > >>>On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever" >>><moikef@n_o_s_p_a_m.gmail.com> wrote: >>> >>>[snip] >>>>The problem is that either by exporting the coefficients (SOS >>form,Direct >>>>Form I ) to Matlab workspace or by generating C header file it is >>unclear >>>>to me which coefficients I should place in my API - I have 3 sections >>>>(stages) and I am required to give the coefficients in a form of : >>>> {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...} >>>>where b1x and a1x are the coefficients for the first stage, b2x and a2x >>are >>>[snip] >>>>So the question is how can I extract the coefficients either from Matlab >>>>workspace or from c header file ? >>>>Thank You >>>> >>>This whole post is kind of nut balls. I mean the guy has the manuals >>>for the API and for MATLAB at his disposal. IT is not hard to match >>>them up and make the application work. Unless the numbering is just >>>totally insane this should be plug and play from MATLAB. >>> >>>Mark DeArman >>> >> >> >>I wish this was really plug and play ,as you say ,but ,unfortunately ,it is >>not . >Yes it is. I can plug MATLAB into my program with ease... I just push >the button. > >>I came across several messages regarding the same subject - The >>generated C header was supposed to be crystal clear and easy to implement >>,but is far from that. >Not so... It is very easy if you read the documentation. > >>I also observe a lot of labs in DSP course in >>universities/college who use work around methods to extract those >>coefficients and i could continue on and on. >Holy shit you are my worst nightmere at college! >>If it was so easy , I wouldn't >>write this post from the beginning, so please focus on solving the issue >>,and not saying how it is easy and how knoob I am >My god... I sure hope you are an undergrad or I'm going to kill >myself later. >>.Saying the subject is >>easy will not make it any easier. >Well why the fuck are you in college? >>Thank all for helpful responses,it helped a lot.Only one little thing left >>to figure out and I am good and ready to continue >Your question is so stupid that my mind is blown? Please learn to ask >questions and I would be happy to...
Sorry, that was inn. app. beyond.... I just got so pissed off. Mark DeArman
On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever"
<moikef@n_o_s_p_a_m.gmail.com> wrote:

     [Snipped by Lyons]

>The problem is that either by exporting the coefficients (SOS form,Direct >Form I ) to Matlab workspace or by generating C header file it is unclear >to me which coefficients I should place in my API - I have 3 sections >(stages) and I am required to give the coefficients in a form of : > {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...} >where b1x and a1x are the coefficients for the first stage, b2x and a2x are >the coefficients for the second stage, and so on. The array contains a >total of 5*numStages values.
Hi V14ever, I always hesitant to reply to posters who won't reveal their real names, but you seem to need help (and Mac Decman was far to hard on you). So here are my two cents: I use Matlab but I've never used the fdatool. I launched the fdatool and entered some simple IIR filter fpass and fstop numbers in the cells and clicked the 'Design Filter' button. Direct Form II, second-order sections, Design method = IIR, Butterworth Units = Hz Fs = 48000 Fpass = 4600 Fstop = 20000 The software designed a 4th-order filter. Next, under the 'Analysis' tab I selected 'Filter coefficients', and the coefficients were displayed for the filter's 2nd-order sections. Next, under the 'File' tab I clicked 'Export'. Under the 'Export to' cell I chose 'Text-file' and clicked OK. That saved a text file with some of the coefficients missing from the list!!! Sheece, I can't explain that foul-up. Either I don't understand what those button clicks are supposed to do, or there's a bug in the fdatool. Next , again under the 'File' tab I clicked 'Export'. Under the 'Export to' cell I chose 'Mat-file' and clicked OK. I saved the coeffs under the filename: 'JanTest.mat'. That saved a 'JanTest.mat' file with all the coefficients properly listed. In the Matlab Control window I entered load('C:\MATLAB6p5\work\JanTest.mat'), G, SOS and Matlab replied with: G = 0.0074 SOS = 1.0000 2.0000 1.0000 1.0000 -0.9413 0.2459 1.0000 2.0000 1.0000 1.0000 -1.2081 0.5991 So now I have the coefficients, of the two 2nd-order, Direct Form II, IIR filters, available to me. I don't know where maury found the documentation on how to interpret the meanings of the 'G' and 'SOS' values, but at least now you know how to list those 'G' and 'SOS' values. Good Luck, [-Rick-]
On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever"
<moikef@n_o_s_p_a_m.gmail.com> wrote:

   [Snipped by Lyons]

V14ever,

  you might help at:

http://www.mathworks.com/products/signal/demos.html?file=/products/demos/shipping/signal/introfdatooldemo.html#10

[-Rick-]
On 1/17/2012 8:27 AM, Rick Lyons wrote:
> On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever" > <moikef@n_o_s_p_a_m.gmail.com> wrote: > > [Snipped by Lyons] > > V14ever, > > you might help at: > > http://www.mathworks.com/products/signal/demos.html?file=/products/demos/shipping/signal/introfdatooldemo.html#10
Rick, Youse is a good guy! Did you let Mathworks know about the bug you found? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On Jan 16, 12:32&#4294967295;pm, "Vl4ever" <moikef@n_o_s_p_a_m.gmail.com> wrote:
> > The > >last row of the gain matrix is the gain applied to the over filter. > >It's all right there in the documentation. > > >Maurice Givens > > Could you point me to the documentation ? Thank You. > This could sound as a dumb question ,but what do you mean by gain applied > to the over filter? Does that mean that multiplication is applied after the > first three multiplications? or beforehand?
In Matlab, if you click the menu button at the top that says HELP, you will get a pull-down menu. If you click the SEARCH tap and put in SOS you will get lotsssss of entries about the SOS matrix, functions using the SOS matrix, and the first entry says, in part: The second-order section format of H(z) is given by [ED: equation is shown here] sos is an L-by-6 matrix that contains the coefficients of each second- order section in its rows. [ED: More equations and matrix itself is shown here] Additionally, the disk should have the book for signal processing toolbox. If youy are at a school, usually IT will put the documentation in the drive with the software. Maurice Givens
On Tue, 17 Jan 2012 11:22:45 -0500, Jerry Avins <jya@ieee.org> wrote:

>On 1/17/2012 8:27 AM, Rick Lyons wrote: >> On Sat, 14 Jan 2012 15:06:04 -0600, "Vl4ever" >> <moikef@n_o_s_p_a_m.gmail.com> wrote: >> >> [Snipped by Lyons] >> >> V14ever, >> >> you might help at: >> >> http://www.mathworks.com/products/signal/demos.html?file=/products/demos/shipping/signal/introfdatooldemo.html#10 > >Rick, > >Youse is a good guy! Did you let Mathworks know about the bug you found? > >Jerry
Hi Jer, No I didn't. In the past when I thought I found a bug in some commercial software it usually turned to be my 'operator error' instead of a bug. Maybe I'll experiment further to se4e waht I can learn. See Ya', [-Rick-]