How can I plot in dB in Matlab?

114 visualizaciones (últimos 30 días)
Joel Ruiz
Joel Ruiz el 31 de Ag. de 2020
Respondida: Peter O el 31 de Ag. de 2020
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))));

Respuestas (1)

Peter O
Peter O el 31 de Ag. de 2020
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.

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by