05 September 2019 4 7K Report

I have a doubt about the unit of amplitude on y axis on linear plot of a sound wave generated in Matlab.

In logarithmic 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.

In this image the value of power at 404.2 Hz in -1.26 dB on log scale and 404.2 on linear scale..What is the maths behind this conversion and what should be the ideal unit on Y axis on linear scale?

I currently use "V" which I think is wrong.

Also I have attached section of my code which is generating this plot.

--------------------------

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);

-------------------------------------------------

More Akshat Negi's questions See All
Similar questions and discussions