Regarding code addnoise.m in ideal binary mask

1 view (last 30 days)
while running addnoise.m code available in ideal binary mask folder on mathworks site I've come across a command SNR = @(signal,noisy)( 20*log10(norm(signal)/norm(signal-noisy)) ); what is meaning of @(signal,noisy)? The terms in second bracket are signal to noise ratio in db.Then what is the need of @?

Answers (1)

Image Analyst
Image Analyst on 1 Feb 2015
Edited: Image Analyst on 1 Feb 2015
It indicates that it is an anonymous function. Sort of like a short one-liner macro type of function rather than a full blown function like you're probably used to. Maybe they call it anonymous because no one understands them or knows what they are or how to use them, as is evident in your case, and with many other novices. :-)
If you like, you can use a traditional function instead of that cryptic one-liner form.
function output = SNR(signal,noisy)
output = 20*log10(norm(signal)/norm(signal-noisy));
The @ in the line indicates that it's now going to list the input arguments. They are listed separated by commas and wrapped in parentheses.

Categories

Find more on Author Block Masks in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!