Error in snr calculation of denoised signal
1 view (last 30 days)
Show older comments
Hello,
I'm loading audio signal (.wav) and adding awgn noise vector with snr = 5,
after that I'm using wden for denoising and I want to compute the snr of the denoised signal.
my code is:
[male, Fs1] = audioread('male.wav');
% Transpose audio signals
male = male.';
snr = 5; % SNR value in dB for adding awgn noise
n = randn(size(male))*std(male)/db2mag(snr); % AWGN noise
male_noisy = n + male;
[denoised,C,L,THR] = wden(male_noisy,'heursure','s','mln',3,'db8');
SNR = snr(denoised, n);
The error I'm getting is:
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Why do I get that error?
0 Comments
Answers (1)
Image Analyst
on 24 Dec 2021
You forgot to give the line number it told you. Please put all the red text, not just a part of it. In particular, which of those lines threw the error.
Also, you didn't name your m-file, or any other m-file, snr.m did you? Because if it's this line
SNR = snr(denoised, n);
it might be thinking that snr is a function (meaning an m-file) or a matrix that you created. What does this say
which -all snr
See the FAQ for a thorough discussion.
0 Comments
See Also
Categories
Find more on Discrete Multiresolution Analysis 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!