-
Notifications
You must be signed in to change notification settings - Fork 0
/
regionmathematica.nb
34 lines (28 loc) · 1.35 KB
/
regionmathematica.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(*Author Adrian Josue Guel Cortez
January 2021
If this code helped you please cite one of the folowing works
César Fernando Méndez Barrios, "Low-Order Controllers for Time-Delay Systems : an Analytical Approach". 2012 PhD thesis
Guel-Cortez, Adrián Josué, et al. "Geometrical design of fractional PDμ controllers for linear time-invariant fractional-order systems with time delay."
Proceedings of the Institution of Mechanical Engineers, Part I: Journal of Systems and Control Engineering 233.7 (2019): 815-829.
*)
Co[s_] := kp + kd*s;
Gs[s_] := ((-s^4 - 7*s^3 - 2*s + 1)*
E^(-s/20))/((s + 1)*(s + 2)*(s + 3)*(s + 4)*(s^2 + s + 1));
T[s_] := FullSimplify[Gs[s]*Co[s]/(1 + Gs[s]*Co[s])];
P[s_] := Denominator[T[s]];
FullSimplify[
Solve[ComplexExpand[Re[P[I*w]]] == 0 &&
ComplexExpand[Im[P[I*w]]] == 0, {kp, kd}]]
kpx[w_] := (-(24 - 257 w^2 + 730 w^4 - 579 w^6 + 31 w^8 + w^10) Cos[w/
20] + w (122 - 481 w^2 + 792 w^4 - 229 w^6 - 4 w^8) Sin[w/
20])/(1 + 4 w^2 - 30 w^4 + 49 w^6 + w^8);
kdx[w_] := (w (-122 + 481 w^2 - 792 w^4 + 229 w^6 + 4 w^8) Cos[w/
20] - (24 - 257 w^2 + 730 w^4 - 579 w^6 + 31 w^8 + w^10) Sin[w/
20])/(w + 4 w^3 - 30 w^5 + 49 w^7 + w^9);
SetDirectory[NotebookDirectory[]];
<< ToMatlab.m
f = OpenWrite["ejemplo.m"];
WriteMatlab[kpx[w], f, "kpx"];
WriteMatlab[kdx[w], f, "kdx"];
WriteMatlab[Gs[s], f, "Gs"];
Close[f];