Effacer les filtres
Effacer les filtres

Discrete input signal and continuous transfer function

18 vues (au cours des 30 derniers jours)
Nerma Caluk
Nerma Caluk le 14 Oct 2022
Commenté : Nerma Caluk le 18 Oct 2022
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 commentaires
Sam Chak
Sam Chak le 15 Oct 2022
@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 le 18 Oct 2022
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.

Connectez-vous pour commenter.

Réponse acceptée

Star Strider
Star Strider le 15 Oct 2022
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 commentaires
Star Strider
Star Strider le 15 Oct 2022
My pleasure!
Nerma Caluk
Nerma Caluk le 18 Oct 2022
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!

Connectez-vous pour commenter.

Plus de réponses (1)

Paul
Paul le 15 Oct 2022
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 commentaire
Nerma Caluk
Nerma Caluk le 15 Oct 2022
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!

Connectez-vous pour commenter.

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by