I am currently working on a project and I need to derive a transfer function such that it can be used with lsim() based on its analytical expression. I have the following code :
freq = logspace(-4,2,1000);
w = 2*pi*freq;
tauR = 10e-6;
OmegaR = pi/(2*tauR);
T = 60e-3;
H_a1 = ((4*1i*OmegaR*w.*sin(w.*(T+2*tauR)/2))./(w.^2-OmegaR^2)) .*...
(cos(w.*(T+2*tauR)/2) + OmegaR*sin(w.*T/2)./w) .* (2*pi*freq).^(-2);
Which correspond exactly to my transfer function Transfer function graph
But now I would like to express it as a ss object so that I can use it in lsim(H_a1, u, t) in order to see its effect. How can I do that ?
Here are the 4 things that I have tried so far without success
%1
H = H_a1 .* freq.';
H_AQG = tf(H, 1);
%2
H = arrayfun(H_a1, 2*pi*freq);
H_AQG = tf(H, 1);
%3
s = tf('s');
H_s1 = 1/(1 + (s/OmegaR)^2);
H_s2 = exp(-s*T/2);
H_AQG = H_s1 * H_s2;
%4
H_AQG = frd(H_a1,2*pi*freq);
H_AQG = fitmagfrd(H_AQG,40);