Hi Claus,
If I understand you correctly (as mentioned by Rafael "I do not see how
you can “close the loop”, other that testing your theoretical model
against experimental data?"
1. you have a system which you have theoretical result (reference model)
2. you have another set of data which you want to compare with the
reference model
As you're the subject expert in your own code, I will leave it to you as
it will take time to look into them. :)
Instead, I illustrate something similar (I think) which you might be
able to adopt into your own code.
Codes below perform following steps:
1. Create a linear model in s domain.
2. Convert the model to z domain.
3. Get the impulse response from the z model.
4. From the impulse response data, find the frequency response (in your
case, it should be the data H that you obtained somewhere?)
5. Compare the response in 4 with the model response.
rgds,
CL
// Linear System in Time Domain
s=%s;
G = syslin('c', 10*s^2 , 3*s^2 + s + 2);
// Discreate Model
Ts = 0.05; // Sampling time for discrete model
SS_z = cls2dls(tf2ss(G),Ts);
tz = [0:Ts :50]';
u=ones(tz);
y2_step=dsimul(SS_z,u'); //Step response
u=zeros(tz);u(1)=1;
y2_imp=dsimul(SS_z,u'); //Impulse response
// Compute Bode plot from Impulse Response
tau_step = Ts;
H = y2_imp;
fs = 1/tau_step;
// Following part is the same code as earlier
b = poly(H($:-1:1),"z","coeff");
a = %z^(length(H)-1);
Gz = syslin('d',b,a);
Gz.dt = 1/fs;
[F,M]=repfreq(Gz,0.001,fs/2,0.01);
// Comparison
bode(G); // Ideal frequency response
plot(F(2:10:$),20*log10(M(2:10:$)),'r.'); // generated frequency response with
repfreq
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users