How to convert magnitude to dB in matlab I exported a diagram from FDTD simulation, and now I want to change the magnitude to dB, here is the exported codes:
ax1 = axes; 

plot(lum.x0,lum.y0)

set(ax1, 'XLim', [1.49806e-06 1.60194e-06])

set(ax1, 'YLim', [-0.0232806 1.22328])

set(ax1,'XGrid', 'on')

set(ax1,'YGrid', 'on')

and the ploted spectrum is shown below

I just wondering how to convert the magnitude to dB?
I know there is a function called mag2dB, but i just dont know how to use it.
any help would be very appreciate.
valueInDB = 10*log10(magnitude.*conj(magnitude));