Prev: padlength
Next: Help om 256 channel ADSL model
From: sunil koundinya on 18 Mar 2010 06:14 HI, I am in need of help urgently....in my program there is a need of getting a variable in MATLAB into C...how is it possible??? Actually filter Coefficients are calculated in MATLAB using FIR1 and later this coefficients are used in C program to design the filter..So please help me how can i pass this variable into C??please state even an example if it is available..
From: Rune Allnor on 18 Mar 2010 06:20 On 18 Mar, 11:14, "sunil koundinya" <sunil222sup...(a)yahoo.co.in> wrote: > HI, I am in need of help urgently....in my program there is a need of getting a variable in MATLAB into C...how is it possible??? Actually filter Coefficients are calculated in MATLAB using FIR1 and later this coefficients are used in C program to design the filter..So please help me how can i pass this variable into C??please state even an example if it is available.. If you design your filter in matlab and want to use the coefficients in a C program, the by far simplest way to move the numbers is a good old copy - paste. If you are going to design several filters, so you need to do this many times, just dump the coefficients to a text file and read it from the C program. Rune
From: Wayne King on 18 Mar 2010 06:42 "sunil koundinya" <sunil222superb(a)yahoo.co.in> wrote in message <hnsudc$bmg$1(a)fred.mathworks.com>... > HI, I am in need of help urgently....in my program there is a need of getting a variable in MATLAB into C...how is it possible??? Actually filter Coefficients are calculated in MATLAB using FIR1 and later this coefficients are used in C program to design the filter..So please help me how can i pass this variable into C??please state even an example if it is available.. Hi Sunil, there are a couple of options off the top of my head: 1.) If you have the Real-Time Workshop, you can generate C code using the fir1() function. fir1() is part of the subset of Signal Processing Toolbox functions that are supported by Embedded Matlab. See the Signal Processing Toolbox User's Guide for a complete list and examples on usage. 2.) You can write your C program and use the MATLAB output (the filter coefficients from fir1()) directly in the C code ex: b=fir1(10,0.2); %coefficients returned and used in C program in C static real B[11] = { 7.3914231509637267E-019, 9.3042831450181451E-003, 4.7577766134417450E-002, 1.2236354636114467E-001, 2.0224655842984032E-001, 2.3701569185915902E-001, 2.0224655842984032E-001, 1.2236354636114467E-001, 4.7577766134417450E-002, 9.3042831450181451E-003, 7.3914231509637267E-019 }; Wayne
|
Pages: 1 Prev: padlength Next: Help om 256 channel ADSL model |