MATLAB Answers


erosion and dilation in signal processing

Asked by Annapoorani
on 4 Feb 2012
Latest activity Commented on by Image Analyst
on 22 Aug 2014

we need codes for erosion and dilation in signal imdilate and imerode functions can only be used in image processing..


2 Answers

Answer by Image Analyst
on 4 Feb 2012
 Accepted answer

They can be used for 1D signals, if you have the Image Processing Toolbox. Do you have that toolbox? If not, you might play around with this approach:

windowSize = 3;
originalSignal = rand(10,1)
hank = hankel(originalSignal)
h3 = hank(:,1:windowSize)
dilatedSignal = max(h3, [], 2)


ya no is for the toolbox,sorry abt tat... mm thanks for answering,i wil try it and let yo know

we tried imdilate got the answer but imgage is not displaying,it comin as image too large to fit on what should we do to view the dilated image

If you don't have the Image Processing Toolbox, then how did you try imdilate()?

Answer by shelley
on 22 Aug 2014

Yes, it is doable. It is better to binarize the signal first, and then use the command like


%the length 120 depends on how big the gap you want to close/seal.

%the degree 90 or 0 depends on your 1D signal is in vector or row format;



Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!