Filter löschen
Filter löschen

How to turn S11 to time domain by Matlab

48 Ansichten (letzte 30 Tage)
Guan Hao
Guan Hao am 16 Apr. 2024
Kommentiert: Walter Roberson am 2 Jul. 2024 um 19:23
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 Kommentare
Mathieu NOE
Mathieu NOE am 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)
Guan Hao
Guan Hao am 16 Apr. 2024
Bearbeitet: Guan Hao am 17 Apr. 2024
@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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Mathieu NOE
Mathieu NOE am 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 Kommentare
Mathieu NOE
Mathieu NOE am 28 Mai 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
Guan Hao
Guan Hao am 28 Mai 2024
@Mathieu NOE I'm not sure that the spectrum is exactly the pulse train...It's just a guess.
What I want to do is try to construct the frequency response with two pulse.
Anyway, I've learned how to solve the periodic problem from you! Thanks a lot again!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Guan Hao
Guan Hao am 1 Jul. 2024 um 6:08
@Mathieu NOE Hi,sir! I got a really simple question here. I attempted to describe a phenomenon in frequency domain by building a math model. If the model worked, it should obtain the same frequency response as the simulation softwares. However, it's too complicated to achieve my goal on frequency domain.
Let's say there were two factors A & B that caused my model wrong in frequency domain. Was it possible to turn the frequency response F1 which contained A & B and F2 which only contained A into time domain, turning the result of F1-F2 back to frequency domain,so that I could know how much the factor B influence in frequency domain.Thanks!
  2 Kommentare
Mathieu NOE
Mathieu NOE am 2 Jul. 2024 um 12:41
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 ?
Walter Roberson
Walter Roberson am 2 Jul. 2024 um 19:23
You should start your own Question for this.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by