![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1689562/image.png)
How di I find the FWHM of the curve and also convert the units from Watts to Decibles
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Abhinav Aravindan
2024-5-8
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);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1689562/image.png)
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!