How to turn S11 to time domain by Matlab
36 views (last 30 days)
Show older comments
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
on 16 Apr 2024
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)
Accepted Answer
Mathieu NOE
on 17 Apr 2024
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');
23 Comments
Mathieu NOE
on 28 May 2024
hello again
are you sure that the figure you post is the spectrum of a pulse train with time distance = 0.667e-9 s ?
if we say that a pulse is a very narrow rectangular pulse , and we consider a train of such narrow rect pulses then we should get the result as written in this article
More Answers (1)
Guan Hao
on 1 Jul 2024
2 Comments
Mathieu NOE
on 2 Jul 2024
hello
I am not 100% to understand how you want to proceed
why do you have this problem with the first frequency domain model ? can you share some data and code ?
See Also
Categories
Find more on Analog Filters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!