How di I find the FWHM of the curve and also convert the units from Watts to Decibles

1 Ansicht (letzte 30 Tage)
clear all
close all
clc
L=10;
n=1.45;
c=2.9979e8;
dt = 6e-12;
T=10*2*L*n/c;
eps0=8.854e-12;
A=80e-12;
t = (-T/2/dt:1:T/2/dt)*dt;
Nt=round(T/dt);
fsine = 1e9;
vsine = 1;
phi = vsine*sin(2*pi*fsine*t);
EL1t=1.274e7*exp(1i*phi);
FP=fft(phi);
fs=1/dt/Nt;
Fs=(-1/dt/2:fs:1/dt/2-1);
figure
Z=plot(Fs,fftshift(abs(fft(EL1t/Nt).^2*2*n*c*eps0*A)));
How do I find the FWHm of the curve , should I consider sidebands also while calculating or just find FWHM in the peak curve only?
And also how do I convert the Y axis units from Watts to Decibles...

Akzeptierte Antwort

Abhinav Aravindan
Abhinav Aravindan am 8 Mai 2024
I see that you are trying to determine the FWHM of the curve and want to convert the “Y-axis” values from Watt to dB. The plot appears to have multiple peaks with narrow widths. To calculate the FWHM, the “pulsewidth” function can be utilized as follows where “w” is the width and “initcross” and “finalcross” are the corresponding start and end x-coordinates of the half-width:
[w,initcross,finalcross] = pulsewidth(fftshift(abs(fft(EL1t/Nt).^2*2*n*c*eps0*A)), Fs);
The spectrum can be converted to dB by computing the “log10 “ value and multiplying it by 10.
power_db = 10*log10(“replace signal here”);
It is important to note that the plot contains “0” values and hence computing the “log” results in “-Inf”. This needs to be addressed accordingly, for instance, replacing the “-Inf” values with “0”. “FWHM” is typically calculated for the highest peak, but the sideband “FWHM” may be considered depending on the nature of application.
Please find below the documentation link for “pulsewidth”:

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by