Error in snr calculation of denoised signal
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Image Analyst
2021년 12월 24일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!