Unit of amplitude on y axis in linear plot.

7 views (last 30 days)
AKSHAT NEGI
AKSHAT NEGI on 3 Sep 2019
Commented: Renato SL on 6 Sep 2019
I have a doubt about the unit of amplitud eon y axis on linear plot of a sound wave in signal analyzer.
In lograthmic scale it is dB but I am confused about what it should be on the linear scale and what is the maths behind the conversion that would be a plus if someone has any idea bout it.
  5 Comments
AKSHAT NEGI
AKSHAT NEGI on 5 Sep 2019
Thank you again for the help... I am not able to find the conversion maths... where i can convert for example the value at 404.2 Hz is 0.004 to -1.26 db in log scale...
I have attached the section of the code below
-----------------------------------------------------
fSep=1/(N*h);
disp(['FFT frequency separation = ' num2str(fSep) ' Hz'])
[Y,f,YdB]=SimpleLineSpectrum2(y,h,0,fny);
figure
subplot(211)
plot(f,Y,'LineWidth',1.5),grid
title(['Line Spectrum of ' name ],'fontweight','bold','fontsize',10)
ylabel('Linear power(V)')
xlabel('Frequency (Hz)')
axis([fL fR 0 max(Y)])
subplot(212)
plot(f,YdB,'LineWidth',1.5),grid
title('Line Spectrum in dB','fontweight','bold')
ylabel('power (dB)')
xlabel('frequency (Hz)')
axis([fL fR dBmin 0])
pause
--------------------------------------------------------
and this is what "Simplelinespectrum " is doing
% normalize by 2*np
np=length(y); % length of the input vector
%===remove the mean
yavg=mean(y);
y=y-yavg;
%===calculate the fast Fourier transform
Y=fft(y(1:np));
%===generate the frequencies in the frequency grid
nint=fix(np/2);
i=1:nint+1;
f(1:nint+1)=(i-1)/(np*h);
%===take the absolute value and normalize
Ya=2*abs(Y(1:nint+1))/(np); % normalization
% Ya=abs(Y(1:nint+1)); % no normalization
%===generate the frequencies and magnitudes to be
% returned consonant with frLeft and frRight
fL=frLeft;
iL=fix(1+np*h*fL);
fR=frRight;
iR=fix(1+np*h*fR);
retYa=Ya(iL:iR);
retf=f(iL:iR);
Ymax=max(retYa);
YdB=20*log10(retYa/Ymax);
-------------------------------------------------
Please let me know if this helps to recognize whats exactly happening..thank you very much for your time and help.
2.JPG
Renato SL
Renato SL on 6 Sep 2019
For this part
ylabel('Linear power(V)')
please make sure if the signal is power or voltage. As it is, it doesn't make sense to me. Volt is not the unit for power.
Regarding the conversion to dB, it's there in Simplelinespectrum. The comments in the code are there to help you.
It started with removing the mean, then compute the FFT (Y), then the normalization (Ya), and finally in the last line it is converted to dB (YdB).
The formula for the conversion to dB can be read here.
In general, if you have a code, I believe the best way to get an understanding of it is to ask the author.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!