How can I plot in dB in Matlab?

49 次查看(过去 30 天)
Joel Ruiz
Joel Ruiz 2020-8-31
回答: Peter O 2020-8-31
Hello:
I am working on app designer. My app is about communications and I need to plot the frequency response of a mixer. However, the levels of signal power I'm using are lower than a reference, so I need to plot some negative amplitude levels in dB.
In the real life I need to obtain this:
but in Matlab I don´t know how to plot those negative values.
The code I'm using is this:
function spectrum(app)
%For sin signal and AM
if app.SinButton.Value == true && app.AmplitudeModulationButton.Value == true
[fc,A,Ap,fm,Fs,Ts,N,t,f,mi,Vcdol,Vcdif] = getdata(app);
x = Vcdif+A*sin(2*pi*fm*t); % IF
p= Vcdol+Ap*sin(2*pi*fc*t); % carrier signal
y=((1+mi*x).*p); %modulated signal
plot(app.UIAxes,f,10*log10(abs(fftshift(fft(y))));

回答(1 个)

Peter O
Peter O 2020-8-31
Decibels are a ratiometric measurement. For power, as shown in your plot, the reference is 1 milliwatt (denoted from the dBm). 0dBm means that the ratio is 1.0. If you've only got 0.5 mW output, then the ratio is 0.5e-3/1e-3 =0.5.
PdBm = 10*log10(0.5) = -3dBm.

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by