I'm applying feedback to a discretized time-series transfer function in software, to simulate how a physical system moves (there are other ways, I'm doing it this way for a reason).
The step response of the derived time-series system IS what i'd expect when I match it with a matlab "step" command's output (applied to the original laplace transfer function), but is NOT what I'd expect when I try closing a loop and adding feedback.
Is there something fundamentally flawed with the proportional feedback approach as shown below?
Say I have a continuous open-loop laplace-domain transfer function of a system, 'TF(s)'. Discretize this to z-domain, 'TF(z)'.
Create a time-series from this, with the output 'x' as a function of the input 'u'. I won't show the actual numbers, but the form is x(k+1) = ... *x(k) + ...*x(k-1) ... *u(k) + ...*u(k-1)... etc
The unit-step response is this:
The above appears to work, so I try a feedback loop to track a reference input 'ref':
The latter code doesn't oscillate/settle around 'ref' like I'd expect from simple error feedback. As time grows, x(k) settles on a random values depending on the combination of K and 'ref'. Eg K=1,ref=2 settles at 1. K=2,ref = 0.5 settles at 0.666. K=10,ref=0.5 settles at 3.33.
Obviously, Normally, 'x' would settle around 'ref' with its oscillation freq dependent on K.
Thoughts?
The step response of the derived time-series system IS what i'd expect when I match it with a matlab "step" command's output (applied to the original laplace transfer function), but is NOT what I'd expect when I try closing a loop and adding feedback.
Is there something fundamentally flawed with the proportional feedback approach as shown below?
Say I have a continuous open-loop laplace-domain transfer function of a system, 'TF(s)'. Discretize this to z-domain, 'TF(z)'.
Create a time-series from this, with the output 'x' as a function of the input 'u'. I won't show the actual numbers, but the form is x(k+1) = ... *x(k) + ...*x(k-1) ... *u(k) + ...*u(k-1)... etc
The unit-step response is this:
Code:
FOR k = 1 to whatever time step
u(k+1) = 1 <--unit step input command
x(k+1) = ... *x(k) + ...*u(k) ... etc
housekeeping: shift buffer of x and u vectors, etc.
END
The above appears to work, so I try a feedback loop to track a reference input 'ref':
Code:
ref = 1;
K = 1; <- feedback constant
FOR k = 1 to whatever time step
Error = ref - x(k)
[b] u(k)[/b] = K * Error <- input depends on error; basic proportional feedback. [u]Use this u(k) in next line.[/u]
x(k+1) = ... *x(k) + ...*[b]u(k)[/b] ... etc
housekeeping: shift buffer of x and u vectors, etc.
END
The latter code doesn't oscillate/settle around 'ref' like I'd expect from simple error feedback. As time grows, x(k) settles on a random values depending on the combination of K and 'ref'. Eg K=1,ref=2 settles at 1. K=2,ref = 0.5 settles at 0.666. K=10,ref=0.5 settles at 3.33.
Obviously, Normally, 'x' would settle around 'ref' with its oscillation freq dependent on K.
Thoughts?