PROPT Rigid Body Rotation: Difference between revisions
From TomWiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
<math> J = \frac{1}{4}*\int_0^{1} (u_1^2+u_2^2)^2 \mathrm{d}t </math> | <math> J = \frac{1}{4}*\int_0^{1} (u_1^2+u_2^2)^2 \mathrm{d}t </math> | ||
subject to: | subject to: | ||
<math> \frac{dx}{dt} = a*y+u_1 </math> | <math> \frac{dx}{dt} = a*y+u_1 </math> | ||
<math> \frac{dy}{dt} = -a*x+u_2 </math> | <math> \frac{dy}{dt} = -a*x+u_2 </math> | ||
<math> \frac{du_1}{dt} = a*u_2 </math> | <math> \frac{du_1}{dt} = a*u_2 </math> | ||
<math> \frac{du_2}{dt} = -a*u_1 </math> | <math> \frac{du_2}{dt} = -a*u_1 </math> | ||
<math> x(t_0) = [0.9 \ 0.75] </math> | <math> x(t_0) = [0.9 \ 0.75] </math> | ||
<math> x(t_f) = [0 \ 0] </math> | <math> x(t_f) = [0 \ 0] </math> | ||
<math> a = 2 </math> | <math> a = 2 </math> | ||
<source lang="matlab"> | <source lang="matlab"> |
Revision as of 08:11, 9 November 2011
This page is part of the PROPT Manual. See PROPT Manual. |
On smooth optimal control determination, Ilya Ioslovich and Per-Olof Gutman, Technion, Israel Institute of Technology.
Example 1: Rigid body rotation
Problem Description
Find u over t in [0; 1 ] to minimize:
subject to:
% Copyright (c) 2007-2008 by Tomlab Optimization Inc.
Problem setup
toms t
p = tomPhase('p', t, 0, 1, 20);
setPhase(p);
tomStates x y u1 u2
% Boundary constraints
cbnd = {initial({x == 0.9; y == 0.75})
final({x == 0; y == 0})};
% ODEs and path constraints
a = 2;
ceq = collocate({dot(x) == a*y+u1; dot(y) == -a*x+u2
dot(u1) == a*u2; dot(u2) == -a*u1});
% Objective
objective = 0.25*integrate((u1.^2+u2.^2).^2);
Solve the problem
options = struct;
options.name = 'Rigid Body Rotation';
solution = ezsolve(objective, {cbnd, ceq}, [], options);
t = subs(collocate(t),solution);
x = subs(collocate(x),solution);
y = subs(collocate(y),solution);
u1 = subs(collocate(u1),solution);
u2 = subs(collocate(u2),solution);
Problem type appears to be: con Time for symbolic processing: 0.11175 seconds Starting numeric solver ===== * * * =================================================================== * * * TOMLAB - TOMLAB Development license 999007. Valid to 2011-12-31 ===================================================================================== Problem: --- 1: Rigid Body Rotation f_k 0.470939062500258190 sum(|constr|) 0.000000000003070916 f(x_k) + sum(|constr|) 0.470939062503329120 f(x_0) 0.000000000000000000 Solver: snopt. EXIT=0. INFORM=1. SNOPT 7.2-5 NLP code Optimality conditions satisfied FuncEv 3 GradEv 1 MinorIter 39 Elapsed time: 0.010000 sec.
Plot result
figure(1);
subplot(2,1,1);
plot(t,x,'*-',t,y,'*-');
legend('x','y');
subplot(2,1,2);
plot(t,u1,'*-',t,u2,'*-');
legend('u1','u2');