필터 지우기
필터 지우기

Why my calculation result is not matrix result?

조회 수: 2 (최근 30일)
ZHU z
ZHU z 2022년 4월 10일
댓글: ZHU z 2022년 4월 13일
The result of my matla calculation is a numerical value instead of a matrix result, so I can't draw the relevant graph(figure3):
——The output of AweightedSPL and SPL is a numerical rather than a matrix result,So I can't plot the "frequency-AweightedSPL "spectrum. Input audio has been uploaded
can someone help me see where the code can go wrong?How should I change it?
thanks~
[x,fs] = audioread('123.wav');
L = length(x);
y=fft(x);
f =fs/2.*linspace(0,1,L/2+1);
y = y(1:L/2+1);
plot(f,abs(y),'b');
A= filterA(f);
yweighted = A'.*y;
figure(1);
plot(f,abs(yweighted),'r');
xweighted = ifft(yweighted);
xweighted = real(xweighted);
tempdata = xweighted;
tempL = length(tempdata);
temp1 = fft(tempdata)/tempL*2;
figure(2);
plot(f,abs(temp1),'g');
linelevel =1.8;
preampout = abs(xweighted.*1.8);
preampin = preampout;
pressure = 1000.*preampin./22.78;
pref = 0.00002;
pressure = sqrt(mean(pressure.^2));
AweightedSPL =20.*log10(pressure/pref);
figure(3);
plot(f,AweightedSPL,'b');grid
  댓글 수: 8
ZHU z
ZHU z 2022년 4월 12일
thank you @Matt J
Sorry for the long wait, the input file has been uploaded~
ZHU z
ZHU z 2022년 4월 13일
thank you, @Jeffrey Clark
I will go check it

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio Toolbox에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by