error in discrete space state depeding on coefficient
Show older comments
Im trying to make a space-state controller and there is a problem.
I refered to here: https://ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SystemModeling
There was no problem with continuous state-space open loop response based on transfer function, and discrete space-state, at first.
But i encountered with a problem that the response of discrete state-space doesnt work properly when using another values at J,b,K, etc, of motor.
Here is my code.
This works properly:
--------------------------------------------------------------------------------------------------------------------------------
clc;clear;
J = 0.01;
b = 0.1;
K = 0.01;
R = 1;
L = 0.5;
A = [-b/J K/J
-K/L -R/L];
B = [0
1/L];
C = [1 0];
D = 0;
sys=ss(A,B,C,D);
step(sys)
title('Continuous SS')
x=[0 0]';
u=heaviside(1);
Ts=0.1;
t=Ts:Ts:140;
for i=1:1400
x=(A*Ts+eye(2))*x+B*Ts*u;
y(i)=x(1);
end
plot(t,y)
xlim([0 3.5])
title('Discrete SS')


--------------------------------------------------------------------------------------------------------------------------------
And this fails.
--------------------------------------------------------------------------------------------------------------------------------
clc;clear;
J = 3.2284E-6;
b = 3.5077E-6;
K = 0.0274;
R = 4;
L = 2.75E-6;
A = [-b/J K/J
-K/L -R/L];
B = [0
1/L];
C = [1 0];
D = 0;
sys=ss(A,B,C,D);
step(sys)
title('Continuous SS')
x=[0 0]';
u=heaviside(1)
Ts=0.1;
t=Ts:Ts:140;
for i=1:1400
x=(A*Ts+eye(2))*x+B*Ts*u;
y(i)=x(1);
end
plot(t,y)
title('Discrete SS')


And this problem disturbs me to make state observer, ESO, disturbance compensate at my project by simulink.
Accepted Answer
More Answers (0)
Categories
Find more on State-Space Control Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!