Why my calculation result is not matrix result?

2 次查看(过去 30 天)
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~

请先登录,再进行评论。

回答(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