How to turn S11 to time domain by Matlab
조회 수: 35 (최근 30일)
이전 댓글 표시
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
Mathieu NOE
2024년 4월 16일
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)
채택된 답변
Mathieu NOE
2024년 4월 17일
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
Mathieu NOE
2024년 5월 28일
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
추가 답변 (1개)
Guan Hao
2024년 7월 1일
댓글 수: 2
Mathieu NOE
2024년 7월 2일
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 ?
참고 항목
카테고리
Help Center 및 File Exchange에서 Analog Filters에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!