How can I plot in dB in Matlab?

19 Ansichten (letzte 30 Tage)
Joel Ruiz
Joel Ruiz am 31 Aug. 2020
Beantwortet: Peter O am 31 Aug. 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))));

Antworten (1)

Peter O
Peter O am 31 Aug. 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.

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by