Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %C_1.m
- y_zadane = 1;
- [parametry, blad] = fminsearch('minimalizuj', [8.0, 490.0, 3.0]);
- %minimalizuj.m
- function blad = minimalizuj(X0)
- global y_zadane;
- Kp = X0(1);
- Ti = X0(2);
- Td = X0(3);
- [licz, mian] = zp2tf([], [-1, -1, -1], 1);
- G = tf(licz, mian);
- pid = pidstd(Kp, Ti, Td);
- G_sys = series(pid, G);
- y = step(G_sys);
- e = y - y_zadane;
- blad = sum(((e.^2)/length(e)));
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement