8 |
florent_ba |
1 |
%%% Finds light pulse bandwidth to estimate the needed RX BW
|
|
|
2 |
|
|
|
3 |
lightpower = importdata("lightpulse_12V_100W.txt");
|
|
|
4 |
frame_width = 10e-9;
|
|
|
5 |
|
|
|
6 |
%% Crop of the original signal arround max. pulse value
|
|
|
7 |
time = lightpower.data(:, 1);
|
|
|
8 |
pwr = lightpower.data(:, 2);
|
|
|
9 |
|
|
|
10 |
[peak_val, peak_index] = max(pwr);
|
|
|
11 |
peak_time = time(peak_index);
|
|
|
12 |
|
|
|
13 |
frame_start = peak_time - frame_width/2;
|
|
|
14 |
frame_stop = peak_time + frame_width/2;
|
|
|
15 |
|
|
|
16 |
[frame_start, frame_start_index] = min(abs(time - frame_start));
|
|
|
17 |
[frame_stop, frame_stop_index] = min(abs(time - frame_stop));
|
|
|
18 |
|
|
|
19 |
cropped_time = time(frame_start_index:frame_stop_index);
|
|
|
20 |
cropped_time = cropped_time - cropped_time(1);
|
|
|
21 |
cropped_pwr = pwr(frame_start_index:frame_stop_index);
|
|
|
22 |
|
|
|
23 |
fprintf("Peak power : %f W at %f us\n", peak_val, peak_time*1e6)
|
|
|
24 |
|
|
|
25 |
figure(1)
|
|
|
26 |
plot(cropped_time*1e9, cropped_pwr, "-x")
|
|
|
27 |
ylabel("Light power (W)")
|
|
|
28 |
xlabel("Time (ns)")
|
|
|
29 |
grid on
|
|
|
30 |
|
|
|
31 |
figure(2)
|
|
|
32 |
f = logspace(1, 10, 2000);
|
|
|
33 |
Y = nufft(pwr, time, f);
|
|
|
34 |
loglog(f.*1e-6, abs(Y));
|
|
|
35 |
xlabel("Freq. (MHz)")
|
|
|
36 |
grid on
|