Advertisement
Coriic

Untitled

May 11th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. %C_1.m
  2. y_zadane = 1;
  3. [parametry, blad] = fminsearch('minimalizuj', [8.0, 490.0, 3.0]);
  4.  
  5. %minimalizuj.m
  6. function blad = minimalizuj(X0)
  7. global y_zadane;
  8. Kp = X0(1);
  9. Ti = X0(2);
  10. Td = X0(3);
  11. [licz, mian] = zp2tf([], [-1, -1, -1], 1);
  12. G = tf(licz, mian);
  13. pid = pidstd(Kp, Ti, Td);
  14. G_sys = series(pid, G);
  15. y = step(G_sys);
  16. e = y - y_zadane;
  17. blad = sum(((e.^2)/length(e)));
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement