# Determining the input from the output using IFFT

11 visualizaciones (últimos 30 días)
Ganesh Prasad el 22 de Feb. de 2024
Comentada: William Rose el 3 de Mzo. de 2024
Hello,
I have an output waveform y(t) after having passed through an S-matrix.I need to get the input signal x(t) and the method followed is:
1.Extract S21 from S-matrix and take IFFT of S21 to get the impulse response h(t)
2.convolve output waveform y(t) with 1/h(t) to get back input signal x(t).
The code is written below:
%Read the S parameter matrix and seperate the freq and s matrix data
freq=sp.Frequencies;
s=sp.Parameters;
%Seperate the S21 column from S-matrix and plot S21
S21=rfparam(sp,2,1);
figure;
rfplot(sp_inv);
title('S21 plot');
%Take IIFT of S21 to get impulse response h(t) and plot Impulse response
impulse_response=ifft(S21);
figure;
plot(impulse_response);
Fs = 2*max(freq);
Ts=1/Fs;
N=numel(impulse_response);
tvec=(0:(N-1))*Ts;
figure;
plot(tvec,impulse_response);
title('impulse response');
%convolve output y(t) with 1/h(t) to get back the input x(t)
inverse_impulse=1./impulse_response;
out_time=data(:,1);
output=data(:,2);
convolution_result=conv(output,inverse_impulse);
convolution_time=linspace(min(out_time)+min(tvec),max(out_time)+max(tvec),length(convolution_result));
figure;
plot(convolution_time,convolution_result);
title('input plot after convolution');
%Plot the real input and output
inp_time=data(:,1);
input=data(:,2);
figure;
plot(inp_time,input,'b');
hold on
plot(out_time,output,'r');
title('Actual output in red and input in blue');
However, I see that the input waveform got after running the code and the actual waveform do not match.I have attached the images for reference.
Can somebody help me what needs to be corrected to get the correct result.
##### 11 comentariosMostrar 9 comentarios más antiguosOcultar 9 comentarios más antiguos
Ganesh Prasad el 28 de Feb. de 2024
Please see the S21(please change .txt to .s2p extension) and output waveform file(.xlsx) attached.Thanks.
Paul el 28 de Feb. de 2024
Taking a look at the data
copyfile S21.txt S21.s2p
S = sparameters('S21.s2p')
S =
sparameters: S-parameters object NumPorts: 1 Frequencies: [1774×1 double] Parameters: [1×1×1774 double] Impedance: 50 rfparam(obj,i,j) returns S-parameter Sij
The frequency data does not start at zero. I think if you're going to use the IFFT approach, you'll have to figure out how to extrapolate S21 to zero.
format short e
S.Frequencies([1 end])
ans = 2×1
1.0e+00 * 1.0000e+06 2.7000e+10
figure
semilogx(S.Frequencies,abs(squeeze(S.Parameters)))
The frequencies are not equally spaced (maybe they're spaced logarithmically?). Before taking using IFFT I think you'll have to do an interpoplation to an equally spaced frequency vector.
figure
plot(diff(S.Frequencies))
After those two issues are sorted out, you'll have to also account for the "upper half" of S21 in the frequency domain. Assuming that the impulse response is supposed to be real-valued, check this answer for a discussion on that topic.
I believe that all of these issues need to be addressed first to get the "full picture" of S21 before proceeding with the frequency domain approach suggested by @William Rose or with a time domain approach as you are attempting.
I didn't look at y(t), I suspect that there will be more work to do on that as well depending on decisions made on how you modify the S21 data.
There may be other options to to address this problem as well.

Iniciar sesión para comentar.

William Rose el 28 de Feb. de 2024
Here is a script that does the deconvolution in the frequency domain, using the ideas in my comment above. It also does what @Paul suggested: it interpolates and extrapolates S21(f) to the frequencies of the output signal's Fourier transform.
The script makes five figures, which are mainly to reassure me that everything is working as I expect. The final figure, copied below, shows the output and esitmated input. I am not saying it is perfect.
See comments in the script for details.
##### 6 comentariosMostrar 4 comentarios más antiguosOcultar 4 comentarios más antiguos
Ganesh Prasad el 3 de Mzo. de 2024
@William Rose Thank you for taking the time out and explaining in detail with the code.This will help me verify the results I got from the simulation.
@Paul Thank you for giving your valuable inputs to get the solution to the problem.
Thanks a lot and sorry for the delayed response.
William Rose el 3 de Mzo. de 2024

Iniciar sesión para comentar.

### Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

R2023b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by