Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Vectorized Adaptive noise canceler using LMS filter

5.0 | 1 rating Rate this file 16 Downloads (last 30 days) File Size: 16.8 KB File ID: #16278 Version: 1.0
image thumbnail

Vectorized Adaptive noise canceler using LMS filter


Kiran Kintali (view profile)


07 Sep 2007 (Updated )

This demo shows to call external functions in an Embedded MATLAB block

| Watch this File

File Information

(Demo developed using R2007b)

Embedded MATLAB block in Simulink supports calling three types of functions;

1) Embedded MATLAB builtin library functions
2) Subfunctions within the Embedded MATLAB block script and
3) External MATLAB functions

This demo shows how to call user written compilable "External MATLAB functions" from an Embedded MATLAB block.

The attached model implements a vectorized adaptive noise canceler using a Least Mean Square (LMS) filter written in Embedded MATLAB.

The LMS filter retrieves the original music signal ('err_sig') from Pilot's Mic by filtering the Exterior Mic's signal. The weights of the filter are updated(adapted) in real time based on 'input' and 'err_sig'

The main body of the canceler implementation is part of the block script in
'lms_eml_hardware/Embedded MATLAB Function'. The script embedded in that block calls the following M functions on the path

tapped_delay_fcn.m, treesum_fcn.m, update_weight_fcn.m

For code generation (C and HDL) the user must instruct Embedded MATLAB to compile an external function by adding the following compilation directive or pragma to the function body


For more info related to this topic search for "Calling Functions in Embedded MATLAB" in MATALAB documentation

For general info about Embedded MATLAB visit

Required Products Fixed-Point Designer
MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
27 Apr 2008 farzad MOAZZAMI

I believe LMS is the best line enhancer

Comment only
12 Feb 2008 Ali Buendia

Good use of embedded matlab

10 Sep 2007

updated the screen shot

26 Sep 2007

requires the following wave file matlab\toolbox\dspblks\dspdemos\dspafxf_8000.wav

Contact us