System response from input and output signals
조회 수: 24 (최근 30일)
이전 댓글 표시
My input is chirp signal .How could i get the frequency response of the sysytem from the output . Using this i want to create a database
댓글 수: 0
채택된 답변
Star Strider
2023년 8월 21일
댓글 수: 12
Star Strider
2023년 8월 25일
편집: Star Strider
2023년 8월 25일
The harmonics are probably there. You will need to increase the system order beyond 32 to get an accurate representation, although modeling all of them may not be possible. (It turns out that tfest models this system better than ssest, so use tfest instead.)
EDIT — (25 Aug 2023 at 14:37)
Another approach (signal processing) is to use the firls function to approximate the transfer function —
Uz1 = unzip('AliELENvarFsin...b500_8_23.zip')
Uz2 = unzip('varFsin_1K.zip')
[inpSig,fs]=audioread(Uz2{1});
size_inp = size(inpSig)
fs
[outSig, Fs] = audioread(Uz1{:});
size_out = size(outSig)
Fs
L = numel(inpSig);
t = linspace(0, L-1, L)/fs;
[FTs1,Fv] = FFT1(inpSig,t);
[FTs2,Fv] = FFT1(outSig,t);
transfcn = FTs2 ./ FTs1;
figure
plot(Fv, mag2db(abs(transfcn)))
grid
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')
title('Transfer Function')
n = 350;
f = Fv(1:end-1);
a = abs(transfcn(1:end-1));
b = firls(n, f/max(f), a);
[hz,fz] = freqz(b, 1, 2^16, Fs);
figure
semilogy(f, a, 'DisplayName','Transfer Function')
hold on
plot(fz, abs(hz), 'DisplayName',["FIR Filter (Order "+string(n)+")"])
hold off
grid
legend('Location','best')
function [FTs1,Fv] = FFT1(s,t)
s = s(:);
t = t(:);
L = numel(t);
Fs = 1/mean(diff(t));
Fn = Fs/2;
NFFT = 2^nextpow2(L);
FTs = fft((s - mean(s)).*hann(L), NFFT)/sum(hann(L));
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
FTs1 = FTs(Iv);
end
.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Transfer Function Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!