필터 지우기
필터 지우기

Discrete input signal and continuous transfer function

조회 수: 18 (최근 30일)
Nerma Caluk
Nerma Caluk 2022년 10월 14일
댓글: Nerma Caluk 2022년 10월 18일
I have a discrete input signal, something like an earthquake ground motion, measured every few milliseconds, with a specified units. That input signal has been converted to frequency-domain through FFT.
I also have a trasnfer function which I need to run the discrete input signal through while in frequency domain (I assume), which is very complex. I have succeffully modeled and plotted it with the tf function in MATLAB.
Is there a way to multiply the discrete input signal with the transfer function? I have tried the function lsim function, but it said that a continous system is required. Should I covert the transfer function to a discrete function and the multiply it?
Thank You so much for the help
  댓글 수: 2
Sam Chak
Sam Chak 2022년 10월 15일
@Nerma Caluk, do you mean that you want to inject the Amplitude Spectrum (in Freq domain) of discrete-time input signal S into a continuous-time transfer function?
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
stem(S(1:50))
title("Discrete-time input signal, S(n)")
xlabel("n")
ylabel("S(n)")
Y = fft(S);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
title("Single-Sided Amplitude Spectrum of S(t)")
xlabel("f (Hz)")
ylabel("|P1(f)|")
Nerma Caluk
Nerma Caluk 2022년 10월 18일
Yes, that is exaclty what I meant! I have managed to convert the trasnfer function to discrete system with c2d function, and then use the lsim function. The lsim function did not require amplitude spectrum of the signal, just the original signal and discretized transfer function, but it is giving me very high units. I am not completley sure what exaclty happens in the lsim function and I see no useful examples online.

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2022년 10월 15일
It would likely be best to convert the continuous-time transfer function to a discrete-time transfer function (ideally using the Tustin transformation, using the sampling frequency of the earthquake ground motion signal as the sampling frequency of the discrete filter) and then use that to filter the signal. If you have the Signal Processing Toolbox, this should be relatively straightforward. Realise the discrete transfer function as a second-order-section realisation (rather than a transfer function realisation) for the best results.
  댓글 수: 9
Star Strider
Star Strider 2022년 10월 15일
My pleasure!
Nerma Caluk
Nerma Caluk 2022년 10월 18일
Hi! I have one more question since I cannot find answers anywhere online. If my discrete original signal has certain units in y-axis, let’s say “Digital Units”, and the my discretized Transfer Function has another units, let’s say Digital Units per m/s^2, what would be the output values when the function lsim is used? Would it be the same as the input discretized signal (Digital Units), or the units of transfer functions, or something else completely? Thank You again so much!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Paul
Paul 2022년 10월 15일
Not sure what the issue was with lsim without seeing the code.
Is the transfer function contiuous time, e.g. a model of an analog device or physical structure excited by the earthquake? If so, lsim seems like it could be the way to go for this problem, taking advantage of the foh method if linear interpolation between sampled measurements is a good model of earthquake ground motion (assuming that the dynamics represented by the tf are slow relative to the measurement sample period). If not, more information on what the tf represents would be helpful.
For example using lsim ...
Generate some data at sample period of 1 ms
t = 0:.001:2;
equake = sin(2*pi/3*t);
Continous time transfer function
H = tf(100,[1 2*.7*10 100]);
The output
y = lsim(H,equake,t,'foh'); % works fine
plot(t,equake,t,y)
  댓글 수: 1
Nerma Caluk
Nerma Caluk 2022년 10월 15일
The signal I am running through the trasnfer function has been convreted to frequency domain using FFT, and lsim is giving me an error:
"In time response commands, the time vector must be real, finite, and must contain monotonically increasing and evenly spaced time samples."
I have shared my code in one of the answers/comments above!
Thank You!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by