Advertisement
Guest User

Transfer function identification

a guest
May 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.62 KB | None | 0 0
  1. clear all;
  2. close all;
  3. clc;
  4. warning off;
  5.  
  6. global ti ui yi Ks h1s h2s
  7.  
  8. load Ident13.mat
  9.  
  10. ti=simout(:,1)';
  11. ui=simout(:,3)'-4.1;
  12. yi=simout(:,2)'-3.7;
  13.  
  14. %plot(ti, ui, ti, yi);
  15.  
  16. Ks =0.1792;
  17. h1s =1;
  18. h2s =0.4941;
  19.  
  20. X0=[Ks, h1s, h2s];
  21.  
  22. OPTIONS=optimset('MaxIter',100,'Display','iter','MaxFunEval',1000);
  23. X=fminsearch('Ident_krit',X0,OPTIONS);
  24.  
  25. Ks =X(1);
  26. h1s =X(2);
  27. h2s =X(3);
  28.  
  29. F1=tf(Ks, [h1s h2s 1])
  30. ysim=step(F1,ti);
  31. plot(ti,yi,ti,ysim)
  32.  
  33. %this is separate function Ident_krit
  34. function J=Ident_krit(a);
  35.  
  36. global Ks h1s h2s ti
  37.  
  38. Ks = a(1);
  39. h1s = a(2);
  40. h2s = a(3);
  41.  
  42. sim('Ident_sim',ti(end));
  43.  
  44. J=Jsim
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement