Get the equation of the plot of the response of the transfer function

103 Views Asked by At

In the case of permanent magnet DC motor position control, I wanted to rotate my motor shaft along a reference trajectory. Then I designed a piecewise function for reference and simulated the response (actual trajectory) using Matlab. Now I need to get the equation of the response curve to analyze the current and voltage behavior. This is the response curve code for Matlab.

kp = 10;
kd = 1.3;
kp1 = 5;
pi = 3.14;
y = @(x) (50*pi*x) .* (0<x & x<1/150) +  (pi/3) .* ((1/150<=x) & (x<=3001/150)) + ((3002*pi/3-50*pi*x) .* ((3001/150 <= x) & (x < 1501/75)));%r(t)
x = -1:1/15000:40
sys = tf([0.7274*kd 0.7274*kp],[0.00072 0.07206 0.44244+0.7274*kd 0.7274*kp]);%designed PD control
lsim(sys,y(x),x)%plot of Actual Trajectory with designed control

Now I need to plot the response of $v(t)$ according to the response of actual trajectory. The relationship between the actual trajectory and the $v(s)$ is,

$v(s) = \frac{(0.00072)S^3+(0.07206)S^2+(0.44244)s}{0.7274}\theta(s)$

Finally, What I need to get is $\theta(s)$ which is equal to the actual trajectory. when I get $\theta(s)$, I can plot voltage response using this,

pi = 3.14
syms s
tf  = ((0.00072*s^3+0.07206*s^2+0.44244*S)/(0.7274))*__Theta(s)__;
h = ilaplace(tf)
t = linspace(0,20,50000);   %500 is number of samples to plot
hfun = matlabFunction(h);
plot(t, hfun(t));
hold on;
1

There are 1 best solutions below

1
On BEST ANSWER

Since you know $G_1(s)$ and $G_2(s)$, the transfer functions from $r(s)$ to $\theta(s)$ and from $\theta(s)$ to $v(s)$ respectively, you can combine them

$$ \frac{v(s)}{r(s)} = G_1(s)\,G_2(s). $$

However the order of the numerator of $G_1(s)\,G_2(s)$ is one high then the order of the denominator, so this transfer function would not be causal/proper. However one can factor out a $s$ from $G_2(s)$, which essentially means you have to differentiate $r(t)$, which gives

$$ \frac{v(s)}{\dot{r}(s)} = \frac{G_1(s)\,G_2(s)}{s}, $$

which is causal/proper. So now you only have to differentiate your reference signal defined in y = @(x) with respect to time, which is x in your case. After this you can obtain $v(t)$ using lsim() using the transfer function from $\dot{r}(t)$ to $v(t)$.