Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
robotics-codes-from-scratch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rli
robotics-codes-from-scratch
Commits
97c78802
Commit
97c78802
authored
4 weeks ago
by
Sylvain CALINON
Browse files
Options
Downloads
Patches
Plain Diff
LQT_LS refined
parent
c3cfc7dd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/LQT_recursive.m
+4
-1
4 additions, 1 deletion
matlab/LQT_recursive.m
matlab/LQT_recursive_LS.m
+3
-3
3 additions, 3 deletions
matlab/LQT_recursive_LS.m
with
7 additions
and
4 deletions
matlab/LQT_recursive.m
+
4
−
1
View file @
97c78802
...
@@ -79,7 +79,10 @@ for n=1:2
...
@@ -79,7 +79,10 @@ for n=1:2
x
=
x
+
xn
;
%Simulated noise on the state
x
=
x
+
xn
;
%Simulated noise on the state
end
end
Ka
=
(
B
' * P(:,:,t) * B + Ra) \ B'
*
P
(:,:,
t
)
*
A
;
%Feedback gain
Ka
=
(
B
' * P(:,:,t) * B + Ra) \ B'
*
P
(:,:,
t
)
*
A
;
%Feedback gain
u
=
-
Ka
*
x
;
%Feedback control on augmented state (resulting in feedback and feedforward terms on state)
u
=
-
Ka
*
x
;
%Feedback control on augmented state (resulting in feedforward part and feedback on state)
% u_ff = -Ka(:,end); %Feedforward part on state
% u = u_ff - Ka(:,1:end-1) * x(1:end-1); %Feedforward and feedback part on state
x
=
A
*
x
+
B
*
u
;
%Update of state vector
x
=
A
*
x
+
B
*
u
;
%Update of state vector
r
(
n
)
.
x
(:,
t
)
=
x
;
%Log data
r
(
n
)
.
x
(:,
t
)
=
x
;
%Log data
end
end
...
...
This diff is collapsed.
Click to expand it.
matlab/LQT_recursive_LS.m
+
3
−
3
View file @
97c78802
...
@@ -97,9 +97,9 @@ for n=1:2
...
@@ -97,9 +97,9 @@ for n=1:2
if
t
==
25
&&
n
==
2
if
t
==
25
&&
n
==
2
x
=
x
+
xn
;
%Simulated noise on the state
x
=
x
+
xn
;
%Simulated noise on the state
end
end
%
u = -Ka(:,:,t) * x; %Feedback control on augmented state (resulting in feedforward part and feedback on state)
u
=
-
Ka
(:,:,
t
)
*
x
;
%Feedback control on augmented state (resulting in feedforward part and feedback on state)
u_ff
=
-
Ka
(:,
end
,
t
);
%Feedforward part on state
%
u_ff = -Ka(:,end,t); %Feedforward part on state
u
=
u_ff
-
Ka
(:,
1
:
end
-
1
,
t
)
*
x
(
1
:
end
-
1
);
%Feedforward and feedback part on state
%
u = u_ff - Ka(:,1:end-1,t) * x(1:end-1); %Feedforward and feedback part on state
x
=
A
*
x
+
B
*
u
;
%Update of state vector
x
=
A
*
x
+
B
*
u
;
%Update of state vector
r
(
n
)
.
x
(:,
t
)
=
x
;
%Log data
r
(
n
)
.
x
(:,
t
)
=
x
;
%Log data
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment