Sign in

username or email:

password:



Not a member?
Forgot your password?

Search code



Search tips


See Also

Embedded SystemsFPGA

DSP Code Sharing - Code Snippets - Code Examples

Peak/Notch Filter Design [Matlab]

This function will generate the coefficients for a single IIR biquad that is a "peak/notch" design.  Wierldy enough, this filter type is not part of the standard Matlab filter design toolbox.&nbs...

posted by on May 21 2011
Comments (3) |

Shelving Filter Design [Matlab]

This function will generate the coefficients for a single IIR biquad that is a "shelving" design.  Wierldy enough, this filter type is not part of the standard Matlab filter design toolbox. ...

posted by on May 29 2011
Comments (1) |

Digital Comb Filter [Matlab]

This code snippet will generate numberator(b) and denominator(a) coefficients for a comb filter. (http://en.wikipedia.org/wiki/Comb_filter )   In reality, this code snippet is geared towards si...

posted by on Jun 21 2011
Comments (0) |

Equal Loudness Curves (ISO226) [Matlab]

What is loudness?  No, it is not the setting of your volume knob.  In audio processing, loudness refers to a family of curves that generally describes how the the human ear perceives how "lo...

posted by on Jun 21 2011
Comments (0) |

Zero Crossing Counter [Matlab]

In some DSP applications, it can be very helpful to know how many times your signal has crossed the zero-line (amplitude origin).  How is this helpful?  Well, zero-crossings can tell you ve...

posted by on Jul 9 2011
Comments (3) |

Interleave Zeros [Matlab]

A short and simple piece of Matlab code that can save you some time!  This code will take your input signals and interleave it with zeros.  This can be very helpful when you need to upsample...

posted by on Jul 10 2011
Comments (1) |

Batch WAV file processing [Matlab]

There are may times in DSP algorithm design where you need to run your new and shiny algorithm against a bunch of test vectors.  In audio processing, it is usually WAV files.  The only probl...

posted by on Jul 24 2011
Comments (0) |

Phase changing Allpass IIR Filter [Matlab]

The following Matlab function generates allpass coefficients for an IIR filter.  In this design, the magnitude response is unchanged but the phase response is very different.  This code only...

posted by on Jul 24 2011
Comments (0) |

Exponential Audio Mute [Matlab]

Sometimes "muting" audio can appear to be a simple task on the surface.  However, if you are not careful you can end up with artifacts that are commonly referred to as pops and clicks.  This...

posted by on Aug 7 2011
Comments (0) |

Exponential Audio Unmute [Matlab]

Sometimes "unmuting" audio can appear to be a simple task on the surface.  However, if you are not careful you can end up with artifacts that are commonly referred to as pops and clicks.  Th...

posted by on Aug 7 2011
Comments (0) |

First order RC Filter in the Digital Domain [Matlab]

Here's the situation... Your boss just noticed that the hardware board for you product has this silly thing called an "analog filter" (sounds foriegn nowadays) that consists of a resistor and a capaci...

posted by on Aug 7 2011
Comments (0) |

A-weighting filter [Matlab]

The code below will generate coefficients for a digital A-weighting filter.  What is an A-weighting filter you say?  Perhaps this wikipedia article can help? http://en.wikipedia.org/wiki/A-w...

posted by on Sep 25 2011
Comments (0) |

C-weighting filter [Matlab]

The code below will generate coefficients for a digital C-weighting filter.  What is a C-weighting filter you say?  Perhaps this wikipedia article can help? http://en.wikipedia.org/wiki/A-we...

posted by on Sep 25 2011
Comments (0) |

Pink Noise Generator [Matlab]

This code snippet generates "pink" noise by generating white noise and apply filter to turn it into pink noise.  See wiki article: http://en.wikipedia.org/wiki/Pink_noise In general, pink noise ...

posted by on Sep 26 2011
Comments (0) |

Finding local maxima [Matlab]

The following code snippet is something that I put together for a school project some time ago.  In this project I was trying to apply some speech processing techniques to alter the pitch of a ma...

posted by on Sep 26 2011
Comments (2) |

Finding local minima [Matlab]

The following code snippet is something that I put together for a school project some time ago.  In this project I was trying to apply some speech processing techniques to alter the pitch of a ma...

posted by on Sep 26 2011
Comments (1) |

Percent Error [Matlab]

A lot of times, when I am running Matlab simulations I am comparing how close my results are to real measured data.  It is always a good idea to prove that your DSP simulation is matching what ha...

posted by on Sep 30 2011
Comments (0) |

Measuring Peak-to-Peak [Matlab]

Sometimes you just need a simple Matlab function that does a task that its function name describes exactly.  In this case, I wanted a simple peak-to-peak function that does the same thing the my ...

posted by on Sep 30 2011
Comments (0) |

Least Squares fit to a linear equation [Matlab]

This code applies a Least Squares fit of the supplied data to the form y = mx + b.  X is the observed input and Y is the observed output of the system that you are trying to fit into the standard...

posted by on Sep 30 2011
Comments (0) |

Putting a Matlab figure to a specific screen location [Matlab]

If you've ever wanted to manually position Matlab figures on your screen, you quickly realize that Matlab has a weird way of thinking.  I am used to visual programming languages like Basic or C++...

posted by on Sep 30 2011
Comments (0) |

Saving a Matlab figure to file using command-line [Matlab]

Once again, this is another example that Matlab does weird things with its figure window.  If you use the default function "saveas" it does not save the exact size as it is viewed on your screen....

posted by on Sep 30 2011
Comments (0) |