Clear Filters
Clear Filters

How to turn S11 to time domain by Matlab

72 views (last 30 days)
Hi,everyone.I run HFSS to get S11 for my circuit,HFSS also provide time domain for S11.I want to obtain the same time domain response by Matlab.However the result is not even close.Can anyone help~Thx!
The input signal is an impulse and I perform the frequency domain simulation from 0~7.5GHz.
And both attached files are the result from HFSS.
Here's my code:
load S11_re.txt -ascii
load S11_im.txt -ascii
freq=1e+9*S11_re(:,1);
S11=S11_re(:,2)+1i*S11_im(:,2);
TDR=ifft(S11);
Fs=2*max(freq);
Ts=1/Fs;
N=numel(TDR);
tvec=(0:(N-1))*Ts;
plot(tvec,abs(TDR))
  2 Comments
Mathieu NOE
Mathieu NOE on 16 Apr 2024 at 10:00
the frequency domain data must contain the phase also (we need to compute the ifft of a complex valued transfer function, here you provide only the modulus)
Guan Hao
Guan Hao on 16 Apr 2024 at 10:37
Edited: Guan Hao on 17 Apr 2024 at 12:50
@Mathieu NOE Sorry,I'm not that familiar with the time domain signal.
Thanks for your help ! The phase data of frequency domain has been uploaded.
I've shared the complex value of S11 and also modified my code.

Sign in to comment.

Accepted Answer

Mathieu NOE
Mathieu NOE on 17 Apr 2024 at 16:37
hello again
I am mot sure to understand the shape of the impulse response from your S11_time.txt file :
why only two positive peaks ? from the Bode plot (first figure) I was expecting some kind of damped oscillations - alike what we get from the ifft (nb the symmetrical computation, including negative and positive frequency data)
also I was unsure what is the time unit in the S11_time.txt file ?
% freq domain (transfer function)
load S11_re.txt -ascii % freq + S11_re
load S11_im.txt -ascii % freq + S11_im
freq=1e+9*S11_re(:,1);
frf=S11_re(:,2)+1i*S11_im(:,2);
figure(1),
subplot(2,1,1),plot(freq,abs(frf))
xlabel('freq (Hz)')
ylabel('amplitude')
title('Impulse Response (IR)');
subplot(2,1,2),plot(freq,180/pi*angle(frf))
xlabel('freq (Hz)')
ylabel('phase(°)')
% IR (impulse response) obtained with ifft method
if mod(length(frf),2)==0 % iseven
frf_sym = conj(frf(end:-1:2));
else
frf_sym = conj(frf(end-1:-1:2));
end
TDR = real(ifft([frf; frf_sym])); % NB we need the negative and positive frequency complex FRF
TDR = TDR(1:101); % truncation is possible if TDR decays fast enough
Fs=2*max(freq);
Ts=1/Fs;
N=numel(TDR);
tvec=(0:(N-1))*Ts;
% compare to impulse response generated by your software
load S11_time.txt -ascii % time + IR
time = S11_time(:,1);
IR = S11_time(:,2);
time = time/1e9; % assuming time data was given in nanoseconds
figure(2),
plot(tvec,TDR./max(TDR),'b',time,IR./max(IR),'r')
xlabel('time (s)')
ylabel('amplitude')
title('Impulse Response (IR)');
legend('IR from re/im data','IR from file');
  12 Comments
Guan Hao
Guan Hao about 2 hours ago
@Mathieu NOE Thanks for your reply.
When a signal is traveling in the circuit , it will generate the reflection when the impedance varies. There're two greatest impedance deficit in the circuit that produce two peak of reflection.When I send a signal from input,first reflection occurs at the first impedance deficit and the second reflection occurs at the second impedance deficit,both of the reflections travel back to input port.However,the reflection produced by the second peak produced another reflection when it met the first impedance deficit and it bounced between these two impedance deficit.That's why the third peak was seen in the IR. (multi-reflection)
And the third peak was related to the first and second peak.That's the reason why I'm trying to do correlation to try to predict the third peak.
Hope this is helpful !!!
Mathieu NOE
Mathieu NOE about 1 hour ago
tx for the explanation
before coding it, simply , how do you predict when the third peak should be time localised from the two first peaks ? what is the math behind this ?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!