How to convert the reflection coefficient from the frequency domain to the time domain? Is there anything I have overlooked?
clear
f = linspace(0, 10e9, 101);
% Parameters
Z0 = 50;
Z01 = 50;
Z02 = 75;
ZL = 50;
f1 = 2.5e9;
f2 = 2.5e9;
EL2 = 10;
v = 3e8; % m/s
l2 = (EL2/360) * (v/f2); % m
% Calculate Gamma 1 and Gamma 3
G1 = (Z02 – Z01) / (Z02 + Z01);
G3 = (ZL – Z02) / (ZL + Z02);
% Calculate Gamma
Gamma = (G1 + G3 * exp(-2i * (2 * pi * f) * l2 / v)) ./ (1 + G1 * (G3 * exp(-2i * (2 * pi * f) * l2 / v)));
figure;
% Plot Gamma 的 Amplitude in FD
subplot(2, 1, 1);
plot(f / 1e9, abs(Gamma), ‘b’);
xlabel(‘Frequency (GHz)’);
ylabel(‘|Gamma|’);
title(‘Amplitude of Gamma in FD’);
% Plot Gamma 的 Phase in FD
subplot(2, 1, 2);
plot(f / 1e9, angle(Gamma) * 180/pi, ‘r’);
xlabel(‘Frequency (GHz)’);
ylabel(‘Phase (degree)’);
title(‘Phase of Gmma in FD’);
sgtitle(‘Gamma in FD’);
freq = f;
frf = Gamma;
% IR (impulse response) obtained with ifft method
if mod(length(frf),2)==0 % is even
frf_sym = conj(frf(end:-1:2));
else
frf_sym = conj(frf(end-1:-1:2));
end
% Create full frequency response including negative frequencies
frf_full = [frf, frf_sym];
% Compute the time-domain response (TDR) using ifft
TDR = real(ifft(frf_full));
% Truncate if needed (since frf_sym is conjugate, half of TDR is valid)
TDR = TDR(1:numel(freq));
% Define sampling frequency and time vector
Fs = 2 * max(freq);
Ts = 1 / Fs;
N = numel(TDR);
tvec = (2*(0:(N-1)))/ max(freq);
% Plot the time-domain response
figure;
plot(tvec * 1e9, TDR); % Plot time in nanoseconds
xlabel(‘Time (ns)’);
ylabel(‘Magnitude’);
title(‘Time Domain Reflectometry (TDR)’);clear
f = linspace(0, 10e9, 101);
% Parameters
Z0 = 50;
Z01 = 50;
Z02 = 75;
ZL = 50;
f1 = 2.5e9;
f2 = 2.5e9;
EL2 = 10;
v = 3e8; % m/s
l2 = (EL2/360) * (v/f2); % m
% Calculate Gamma 1 and Gamma 3
G1 = (Z02 – Z01) / (Z02 + Z01);
G3 = (ZL – Z02) / (ZL + Z02);
% Calculate Gamma
Gamma = (G1 + G3 * exp(-2i * (2 * pi * f) * l2 / v)) ./ (1 + G1 * (G3 * exp(-2i * (2 * pi * f) * l2 / v)));
figure;
% Plot Gamma 的 Amplitude in FD
subplot(2, 1, 1);
plot(f / 1e9, abs(Gamma), ‘b’);
xlabel(‘Frequency (GHz)’);
ylabel(‘|Gamma|’);
title(‘Amplitude of Gamma in FD’);
% Plot Gamma 的 Phase in FD
subplot(2, 1, 2);
plot(f / 1e9, angle(Gamma) * 180/pi, ‘r’);
xlabel(‘Frequency (GHz)’);
ylabel(‘Phase (degree)’);
title(‘Phase of Gmma in FD’);
sgtitle(‘Gamma in FD’);
freq = f;
frf = Gamma;
% IR (impulse response) obtained with ifft method
if mod(length(frf),2)==0 % is even
frf_sym = conj(frf(end:-1:2));
else
frf_sym = conj(frf(end-1:-1:2));
end
% Create full frequency response including negative frequencies
frf_full = [frf, frf_sym];
% Compute the time-domain response (TDR) using ifft
TDR = real(ifft(frf_full));
% Truncate if needed (since frf_sym is conjugate, half of TDR is valid)
TDR = TDR(1:numel(freq));
% Define sampling frequency and time vector
Fs = 2 * max(freq);
Ts = 1 / Fs;
N = numel(TDR);
tvec = (2*(0:(N-1)))/ max(freq);
% Plot the time-domain response
figure;
plot(tvec * 1e9, TDR); % Plot time in nanoseconds
xlabel(‘Time (ns)’);
ylabel(‘Magnitude’);
title(‘Time Domain Reflectometry (TDR)’); clear
f = linspace(0, 10e9, 101);
% Parameters
Z0 = 50;
Z01 = 50;
Z02 = 75;
ZL = 50;
f1 = 2.5e9;
f2 = 2.5e9;
EL2 = 10;
v = 3e8; % m/s
l2 = (EL2/360) * (v/f2); % m
% Calculate Gamma 1 and Gamma 3
G1 = (Z02 – Z01) / (Z02 + Z01);
G3 = (ZL – Z02) / (ZL + Z02);
% Calculate Gamma
Gamma = (G1 + G3 * exp(-2i * (2 * pi * f) * l2 / v)) ./ (1 + G1 * (G3 * exp(-2i * (2 * pi * f) * l2 / v)));
figure;
% Plot Gamma 的 Amplitude in FD
subplot(2, 1, 1);
plot(f / 1e9, abs(Gamma), ‘b’);
xlabel(‘Frequency (GHz)’);
ylabel(‘|Gamma|’);
title(‘Amplitude of Gamma in FD’);
% Plot Gamma 的 Phase in FD
subplot(2, 1, 2);
plot(f / 1e9, angle(Gamma) * 180/pi, ‘r’);
xlabel(‘Frequency (GHz)’);
ylabel(‘Phase (degree)’);
title(‘Phase of Gmma in FD’);
sgtitle(‘Gamma in FD’);
freq = f;
frf = Gamma;
% IR (impulse response) obtained with ifft method
if mod(length(frf),2)==0 % is even
frf_sym = conj(frf(end:-1:2));
else
frf_sym = conj(frf(end-1:-1:2));
end
% Create full frequency response including negative frequencies
frf_full = [frf, frf_sym];
% Compute the time-domain response (TDR) using ifft
TDR = real(ifft(frf_full));
% Truncate if needed (since frf_sym is conjugate, half of TDR is valid)
TDR = TDR(1:numel(freq));
% Define sampling frequency and time vector
Fs = 2 * max(freq);
Ts = 1 / Fs;
N = numel(TDR);
tvec = (2*(0:(N-1)))/ max(freq);
% Plot the time-domain response
figure;
plot(tvec * 1e9, TDR); % Plot time in nanoseconds
xlabel(‘Time (ns)’);
ylabel(‘Magnitude’);
title(‘Time Domain Reflectometry (TDR)’); ifft, frequency domain, time domain, reflection coefficients MATLAB Answers — New Questions