Help with calculating impulse/system response of measured analog filter response in the lab
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, I've been trying to extract impulse response and system response from measured magnitude and phase response of an analog filter in the lab, w/o success for the past 3 days. Please help. I have used 2 approaches: 1) Load the data to Matlab, which is the magnitude and phase response for the positive frequencies, then create a full phasor and use of ifft. I got a ~real values returned form the fft (or at least very close to real). The problem is that the time response values looks to be cyclically shifted?? No idea why... Here is the code with plots after loading 2 Excel files with mag and phase per frequency:
if true
%---- convert loaded data to linear gain and radians ------
ssbAmp = 10.^(ampAmpDb / 20);
ssbPhi = phiPhiDeg * pi / 180;
%-------- Interp to have a uniform grid in F --------------
interp_length=2048;
sRate=640e6;
f = 0:sRate/interp_length:sRate/2;
ssbAmpInterp = interp1(ampFreq, ssbAmp, f, 'pchip');
ssbPhiInterp = interp1(phiFreq, ssbPhi, f, 'pchip');
subplot(2,1,1)
plot(f,ssbAmpInterp)
subplot(2,1,2)
plot(f,ssbPhiInterp)
%----------------------------------------------------------
thePhasorSsb = ssbAmpInterp .* exp(j * ssbPhiInterp);
%creating conj. sym. phasor with the format [DC pos.F neg.F]
thePhasor = [thePhasorSsb conj(fliplr(thePhasorSsb))];
thePhasor = thePhasor(1:end-1); %removing redundant DC
a_time = (ifft(thePhasor));
figure;plot(real(a_time));grid on;
%Plot ration between real and imag values
figure;plot(20*log10(abs(real(a_time))./abs(imag(a_time))));grid on;
end
As you can see there is some kind of shift in time. Any idea??
2) The second approach was to use invfreqz.
if true % code
trf = ssbAmpInterp.*exp(j*ssbPhiInterp);
[b, a]=invfreqs(trf,f*(pi/sRate),4,0);
freqz([b, a]);
end
I don't see that freqz gives the same response as I load from Excel files. (Not even close) PLEASE help me !
Thank you.
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spectral Measurements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!