Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I have 2 implement a filter coefficients optimization algorithm. C or MATLAB ?

Status
Not open for further replies.

bmsec

Newbie level 6
Joined
Jan 18, 2011
Messages
13
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,402
Is it advisable to write filter programs in C or MATLAB ?
i have 2 implement a filter coefficients optimization algorithm.
Is it better to write it in C or MATLAB? Later for giving inputs, which is easier ?
 

If you are familiar with C and Matlab programming equally, Matlab is probably the better choice. It has built-in plotting and graphing for frequency response curves as well as DSP related functions and libraries.
 
  • Like
Reactions: bmsec

    bmsec

    Points: 2
    Helpful Answer Positive Rating
Thank u so much.:) I'll contact again if i hav any doubt.
actually i studied matlab long back. but i'll refresh and start working in matlab itself.
also there is no conversion software from C to MATLAB.
i feel giving inputs coefficients is simpler in MATLAB than C.
If i encounter any probs during coding, i'll contact u again :)
thanks and regards
 

Hi,

For any kind of filter design Matlab is the best. Even you can use "fdatool" of Matlab to design filters. You can get the filter coefficients directly and then can use them anywhere you want.

I think but I am not sure that there is option available in Matlab to convert C code into Matlab. But this needs to be verified as I never used it.

Cheers,
MAK
 
  • Like
Reactions: bmsec

    bmsec

    Points: 2
    Helpful Answer Positive Rating
  • Like
Reactions: bmsec

    bmsec

    Points: 2
    Helpful Answer Positive Rating
The conversion tool from C to matlab is possible. Essentially you have to convert you C files to mex files, reassign you numerical arrays to mxArrays and you cna run your C-code from matlab. But personally, I think its simpler to just write the matlab code rather than convert C to Matlab.

www.math.ucla.edu/~getreuer/cmex.pdf

provides a brief explanation of cmex.

Matlab is good for any linear filter design, though some non-linear filters can also be designed without to much difficulty.
C is useful once your ok with your design in matlab and need to optimize it. (You get better control over the parameters)
 
  • Like
Reactions: bmsec

    bmsec

    Points: 2
    Helpful Answer Positive Rating
Hi bmsec,

Did you find any of those links I posted above concerning FIR filter development in Matlab helpful?

Are there any other questions which I could assist you?
 
  • Like
Reactions: bmsec

    bmsec

    Points: 2
    Helpful Answer Positive Rating
I am really grateful for your answer. I missed out seeing the notification for your reply.
Thank You. I've tried fdatool in MATLAB, If it is good, I'll explore it more.
Thanks a lot. I'll contact for any more help.:grin:

Hi,

For any kind of filter design Matlab is the best. Even you can use "fdatool" of Matlab to design filters. You can get the filter coefficients directly and then can use them anywhere you want.

I think but I am not sure that there is option available in Matlab to convert C code into Matlab. But this needs to be verified as I never used it.

Cheers,
MAK


---------- Post added at 18:28 ---------- Previous post was at 18:26 ----------

Thanks, I have started to write in MATLAB itself. fdatool I'll explore more. Thanks a lot.

---------- Post added at 18:32 ---------- Previous post was at 18:28 ----------

I am really grateful for your answer. your links cleared many of my doubts regarding Order estimation.
Also, now I need to go for a trigonometric approximation of the filter specification so that they can be included in constraint equations.
I need constrained Linear programming to generate the boundary values for the coeefts. That can be done in CPLEX or EXCEL SOLVER.
I'm just exploring that.
Thank you so very much. I'll contact for any help.

---------- Post added at 18:33 ---------- Previous post was at 18:32 ----------

I am really grateful for your answer. your links cleared many of my doubts regarding Order estimation.
Also, now I need to go for a trigonometric approximation of the filter specification so that they can be included in constraint equations.
I need constrained Linear programming to generate the boundary values for the coeefts. That can be done in CPLEX or EXCEL SOLVER.
I'm just exploring that.
Thank you so very much. I'll contact for any help.

---------- Post added at 18:34 ---------- Previous post was at 18:33 ----------

I am really grateful for your answer. your links cleared many of my doubts regarding Order estimation.
Also, now I need to go for a trigonometric approximation of the filter specification so that they can be included in constraint equations.
I need constrained Linear programming to generate the boundary values for the coeefts. That can be done in CPLEX or EXCEL SOLVER.
I'm just exploring that.
Thank you so very much. I'll contact for any help.

Hi bmsec,

Did you find any of those links I posted above concerning FIR filter development in Matlab helpful?

Are there any other questions which I could assist you?


---------- Post added at 18:35 ---------- Previous post was at 18:34 ----------

Thank you very much. I've started in MATLAB itself.

---------- Post added at 18:36 ---------- Previous post was at 18:35 ----------

Thank you very much. I"ve started working in MATLAB itself.

The conversion tool from C to matlab is possible. Essentially you have to convert you C files to mex files, reassign you numerical arrays to mxArrays and you cna run your C-code from matlab. But personally, I think its simpler to just write the matlab code rather than convert C to Matlab.

www.math.ucla.edu/~getreuer/cmex.pdf

provides a brief explanation of cmex.

Matlab is good for any linear filter design, though some non-linear filters can also be designed without to much difficulty.
C is useful once your ok with your design in matlab and need to optimize it. (You get better control over the parameters)


---------- Post added at 18:46 ---------- Previous post was at 18:36 ----------

Heyy, these links are really awesome. Million thanks.I'm still going through them.


Here's some tutorials and example of FIR Filter Design for Matlab:

FIR Filter Design using MATLAB

Practical FIR Filter Design in MATLAB

FIR Digital Filter Design

**broken link removed**

**broken link removed**

Practical FIR Filter Design in MATLAB

Finite impulse response (FIR) filter design

Design and Implementation of FIR Filter

Digital Filters with MATLAB

These links should get you started in the right direction.
 

The optimum filter coefficients have to be selected iteratively from a coefficient search space.
The maximum allowable deviation of this realized filter from the desired filter is defined as the cost function which is fixed in advance.
The coefficients selectable from the search space will have to lie within a Maximum and a Minimum value, so that above deviation constraint is satisfied.
There is a constraint equation for this purpose.

Summary of my question :
1. The maximum deviation response possible is fixed.(In general notations, this has to be minimized. Here, it is fixed.)
2. The coefficients have to lie in a range of max and min values, to achieve the above constraint.
3. The maximum and minimum allowable values for each coefficient is to be calculated by Mixed Integer Linear Programming.

How to find the coefficient integer value range (Max and Min values) of each coefficient (h1,h2,h3,etc.) ,when the cost function is fixed?

Hi bmsec,

Did you find any of those links I posted above concerning FIR filter development in Matlab helpful?

Are there any other questions which I could assist you?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top