How di I find the FWHM of the curve and also convert the units from Watts to Decibles
1 view (last 30 days)
Show older comments
Yogesh
on 30 Apr 2024
Answered: Abhinav Aravindan
on 8 May 2024
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...
0 Comments
Accepted Answer
Abhinav Aravindan
on 8 May 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”:
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!