From: Mehmet Fide on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <i1pkc7$k2f$1(a)fred.mathworks.com>...
> "david t53" <david_t53(a)sogetthis.com> wrote in message <i1n8ma$ifc$1(a)fred.mathworks.com>...
> > Thanks for your answer.
> >
> > Good, I have the Real-Time Workshop license.
> >
> > Can you please provide me a quick example of generating C code for
> > creating a butter filter (say, N=10, wn=0.3), fixed-point arithmetics using cascaded bi-quads, and filtering an input vector?
> >
> >
> > Regards,
> > David
>
> Hi David, if you want a biquad structure, then you will need to have the Signal Processing Blockset and use System objects--both signalblks.DigitalFilter and signalblks.BiquadFilter (System objects) support biquad structures--The former in the case of IIR filters. In R2010a, Signal Processing Blockset has Simulink as a recommended product, but it is not required.
>
> By using butter(), you will not be able to implement a biquad filter structure. Basically you will implement your filter using filter() and that uses a direct form II structure transposed.
>
> Wayne

Hi Wayne,

Can you show me a sample, If I like the result, I will buy all required. Because I need such a code generation.

Thanks.

From: Vincent on
"david t53" <david_t53(a)sogetthis.com> wrote in message <i1n8ma$ifc$1(a)fred.mathworks.com>...
> Thanks for your answer.
>
> Good, I have the Real-Time Workshop license.
>
> Can you please provide me a quick example of generating C code for
> creating a butter filter (say, N=10, wn=0.3), fixed-point arithmetics using cascaded bi-quads, and filtering an input vector?
>
>
> Regards,
> David

Hi David,

I would recommend the following route:

1. filterbuilder(Hd)
2. Go to the Code Generation Tab and click Generate Model... then Realize Model
3. Connect an inport and outport to your filter block
4. Press Ctrl-E, select 'Fixed-step' for solver type and click OK
5. Press Ctrl-b to generate C code

Required products:
1. MATLAB
2. Signal Processing Toolbox
3. Filter Design Toolbox
4. Fixed-Point Toolbox
5. Signal Processing Blockset
6. Simulink
7. Simulink Fixed Point
8. Real-Time Workshop

Recommended product:
9. Real-Time Workshop Embedded Coder

Hope this helps,

Vincent
From: Vincent Pellissier on
Vincent wrote:
> "david t53" <david_t53(a)sogetthis.com> wrote in message
> <i1n8ma$ifc$1(a)fred.mathworks.com>...
>> Thanks for your answer.
>>
>> Good, I have the Real-Time Workshop license.
>>
>> Can you please provide me a quick example of generating C code for
>> creating a butter filter (say, N=10, wn=0.3), fixed-point arithmetics
>> using cascaded bi-quads, and filtering an input vector?
>>
>>
>> Regards,
>> David
>
> Hi David,
>
> I would recommend the following route:
>
> 1. filterbuilder(Hd)
> 2. Go to the Code Generation Tab and click Generate Model... then
> Realize Model
> 3. Connect an inport and outport to your filter block 4. Press
> Ctrl-E, select 'Fixed-step' for solver type and click OK
> 5. Press Ctrl-b to generate C code
>
> Required products:
> 1. MATLAB 2. Signal Processing Toolbox
> 3. Filter Design Toolbox
> 4. Fixed-Point Toolbox
> 5. Signal Processing Blockset
> 6. Simulink
> 7. Simulink Fixed Point 8. Real-Time Workshop
>
> Recommended product:
> 9. Real-Time Workshop Embedded Coder
> Hope this helps,
>
> Vincent

Sorry for the bad formatting. Here is what I meant to post.

I would recommend the following route:

1. filterbuilder(Hd)
2. Go to the Code Generation Tab and click Generate Model...
3. Click Realize Model
4. Connect an inport and outport to your filter block
5. Press Ctrl-E, select 'Fixed-step' for solver type and click OK
6. Press Ctrl-b to generate C code

Required products:
1. MATLAB
2. Signal Processing Toolbox
3. Filter Design Toolbox
4. Fixed-Point Toolbox
5. Signal Processing Blockset
6. Simulink
7. Simulink Fixed Point
8. Real-Time Workshop

Recommended product:
9. Real-Time Workshop Embedded Coder

Vincent