Azzera filtri
Azzera filtri

TF of complex signal

4 visualizzazioni (ultimi 30 giorni)
lounis chehrit
lounis chehrit il 8 Giu 2021
Risposto: Sai Pavan il 28 Mar 2024
Hello,
I hope you're doing well.
I have an issue, can you help me on this please?
I have two signal column vectors ( input and output ) : ( very large but they both have the same size):
x_inp=[0.0001, -0.0233, ..... ]
x_out=[0.005, -0.0053, ..... ]
i also have a system TF, which is represented like this:
Real( H(s) ) = 23 cos (2*pi*s) + 12 cos (5*pi*s/10) + 1 cos (2*pi*s)/19 + 0.75 cos (5*pi*s/10).
Imag( H(s) ) =11 sin (3*pi*s) + 7 cos (9*pi*vs2) + 10 sin (2*pi*s)/2 + 1.25 sin (4*pi*s/18).
I want to know if , TF( x_out / x_inp ) = H(s).
I tried this :
sys = Real( H(s) ) + i.* Imag (H(s) ).
so to compute the TF( x_out / x_inp ) i did this :
TL1 = tf ( x_inp )
TL2 = tf ( x_out).
and then :
signal = TL2 ./ TL1.
But it doesn't work.
Can anyone please, tell me how can i compute that tf and compare them to the H(s) system.
Or is there another method to see if TF( x_out / x_inp ) = H(s) ? Wether fft method or something like that.
Thank you in advance !

Risposte (1)

Sai Pavan
Sai Pavan il 28 Mar 2024
Hello Iounis,
I gather that you want to compare the system transfer function with the transfer function generated from input and output signals.
To compare the transfer function (H(s)) of a system with the transfer function derived from input ((x_{inp})) and output signals ((x_{out})), you can use the Fourier Transform to analyze the frequency domain behavior of both the signals and the given (H(s)). The Fourier Transform is suitable for this task because it allows us to examine how different frequencies are altered by the system, which is essentially what a transfer function represents.
Please refer to the below workflow to perform the comparison:
  • First, compute the Fourier Transform of both input and output signals to move from time domain to frequency domain. Then, calculate the ratio of the output to input in the frequency domain, which serves as an experimental transfer function.
  • Compute the given (H(s)) over a frequency range and evaluate it over a range of frequencies to compare it with the experimental results from the Fourier Transform.
  • Compare the experimental transfer function (H_{exp}) derived from your signals with the given (H(s)) by plotting their magnitudes and phases over the frequency range.
Please refer to the below code snippet that illustrates this workflow:
x_inp = rand(100,1); % Random input signal, please insert your input here
x_out = rand(100,1); % Random output signal, please insert your input here
X_inp = fft(x_inp); % Fourier Transform of input signal
X_out = fft(x_out); % Fourier Transform of output signal
H_exp = X_out ./ X_inp; % Experimental transfer function
max_freq = 100; % Please use the required frequency here
% Define frequency vector (omega)
omega = linspace(0, max_freq, length(x_inp));
% Compute H(s) for the frequencies omega
Real_H = 23*cos(2*pi*omega) + 12*cos(5*pi*omega/10) + cos(2*pi*omega)/19 + 0.75*cos(5*pi*omega/10);
Imag_H = 11*sin(3*pi*omega) + 7*cos(9*pi*omega/2) + 10*sin(2*pi*omega)/2 + 1.25*sin(4*pi*omega/18);
H_given = Real_H + 1i*Imag_H;
% Magnitude comparison
figure;
subplot(2,1,1);
plot(omega, abs(H_exp), 'b', omega, abs(H_given), 'r--');
xlabel('Frequency (rad/s)');
ylabel('Magnitude');
legend('Experimental', 'Given');
% Phase comparison
subplot(2,1,2);
plot(omega, angle(H_exp), 'b', omega, angle(H_given), 'r--');
xlabel('Frequency (rad/s)');
ylabel('Phase (radians)');
legend('Experimental', 'Given');
Hope it helps!

Categorie

Scopri di più su Linear Model Identification in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by