# How to measure the pulse width in Plot Graph?

I'm practicing "Inverse Fourier transform" with impulse train using Diracdelta function.

Condition

1. Wavelength: 800(nm)

2. Velocity of Lingt: 299,792,458(m/s)

3. Using 1 and 2 >> Frequency0 = 299,792,458(m/s) / 800(nm)

4. Interval of each frequency: 20Thz

5. Number of Frequency mode: N=20

My question is

"How can I measure the time band-width in Plot graph?"

(Detail is in the image below and there are two questions."

\[Lambda] = 800 10^-9 ;                   (*Wavelength(m)*)
V = 299792458;                (*Velocity of Lingt(m/s)*)
freq0 = V/\[Lambda];                        (*Frequency(Hz))*)
\[Delta] =
20 10^12;                         (*Interval of Each Frequency(Hz)*)
\

A = Sum[DiracDelta[\[Omega] - (freq0 + i \[Delta])], {i, 0,
19}]; (*Get 20 Frequency Mod Using Diracdelta Function*)
B = InverseFourierTransform[A, \[Omega], t,
FourierParameters -> {1, 1}] ;
Plot[A, {\[Omega], 0, 2 freq0}]
Plot[Re[B], {t, -150 (freq0)^-1, 150 (freq0)^-1}, PlotRange -> All,
PlotPoints -> 200, Frame -> True, ImageSize -> 1000]
Plot[(Abs[B])^2, {t, -150 (freq0)^-1, 150 (freq0)^-1},
PlotRange -> All, Frame -> True, ImageSize -> 1000] • The function FindPeaks[] may be helpful. – LouisB Mar 23 '17 at 9:31

As suggested by @LouisB, FindPeaks function can be used as follows.

Firstly, generate data for Re[B] and Abs[B]. In this case, the number of points are 2001.

\[Lambda] = 800 10^-9; V = 299792458;
freq0 = V/\[Lambda];
\[Delta] = 20 10^12;
A = Sum[DiracDelta[\[Omega] - (freq0 + i \[Delta])], {i, 0, 19}];
B[t_] = InverseFourierTransform[A, \[Omega], t,
FourierParameters -> {1, 1}];
step = (2*150. (freq0)^-1)/2000;
xP = Range[-150. (freq0)^-1, 150. (freq0)^-1, step];
yReB = Re /@ B /@ xP;
yAbsB = Abs[#]^2 & /@ B /@ xP;


Secondly, find the peaks which are greater than some value. In this case, you can choose a value of 3.

peaksReB = FindPeaks[yReB, Automatic, Automatic, 3];
(*{{209, 3.01067}, {1001, 3.1831}, {1793, 3.01067}}*)
peaksAbsB = FindPeaks[yAbsB, Automatic, Automatic, 3];
(*{{216, 10.1317}, {1001, 10.1321}, {1786, 10.1317}}*)


Then, find the slopes for the left and right lines of the peaks.

slopesReB =
Extract[Differences[yReB], {{# - 4}, {# + 4}}] & /@
peaksReB[[;; , 1]];
slopesAbsB =
Extract[Differences[yAbsB], {{# - 8}, {# + 8}}] & /@
peaksAbsB[[;; , 1]];


Finally, find the halfpeak values.

halfPeaksReBX = (-(peaksReB[[;; , 2]]/(2 slopesReB)) +
peaksReB[[;; , 1]]);
halfPeaksAbsBX = (-(peaksAbsB[[;; , 2]]/(2 slopesAbsB)) +
peaksAbsB[[;; , 1]]);
halfPeaksReB =
Flatten[#, 1] &@
Tuples@{#1, {#2}} &, {halfPeaksReBX, peaksReB[[;; , 2]]/2}];
(*{{205.882, 1.50534}, {211.465, 1.50534}, {997.941, 1.59155}, {1003.6,
1.59155}, {1790.02, 1.50534}, {1795.72, 1.50534}}*)
halfPeaksAbsB =
Flatten[#, 1] &@
Tuples@{#1, {#2}} &, {halfPeaksAbsBX, peaksAbsB[[;; , 2]]/2}];
(*{{199.026, 5.06583}, {231.843, 5.06583}, {983.762, 5.06606}, {1016.64,
5.06606}, {1768.49, 5.06583}, {1801.44, 5.06583}}*)


To get the time bandwidth between the peaks for Re[B]:

Differences@peaksReB[[;; , 1]]*step
(*{3.17019*10^-13, 3.17019*10^-13}*)


To get the time bandwidth at 50% peak for Re[B]:

-Subtract @@@ Partition[halfPeaksReB[[;; , 1]]*step, 2]
(*{2.23447*10^-15, 2.26314*10^-15, 2.28138*10^-15}*)


Similarly, you can find the same parameters for Abs[B]^2.

Re[B]:

ListLinePlot[yReB,
Epilog -> {Red, PointSize[0.01],
Point[Join @@ {peaksReB, halfPeaksReB}]}, PlotRange -> All,
Frame -> True, ImageSize -> Large] Abs[B]:

ListLinePlot[yAbsB,
Epilog -> {Red, PointSize[0.01],
Point[Join @@ {peaksAbsB, halfPeaksAbsB}]}, PlotRange -> All,
Frame -> True, ImageSize -> Large] 