-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_LPCeVTOL.m
47 lines (39 loc) · 1.59 KB
/
main_LPCeVTOL.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Main script to solve the Optimal Control Problem
%
% Van der Pal Oscillator problem
%
% The problem was originally presented by:
% H. Maurer. 2007. Theory and Applications of Bang-Bang and Singular Control Problems. (2007)
%
% Copyright (C) 2019 Yuanbo Nie, Omar Faqir, and Eric Kerrigan. All Rights Reserved.
% The contribution of Paola Falugi, Eric Kerrigan and Eugene van Wyk for the work on ICLOCS Version 1 (2010) is kindly acknowledged.
% This code is published under the MIT License.
% Department of Aeronautics and Department of Electrical and Electronic Engineering,
% Imperial College London London England, UK
% ICLOCS (Imperial College London Optimal Control) Version 2.5
% 1 Aug 2019
%--------------------------------------------------------
clear all;close all;format compact;
[problem,guess]=LPCeVTOL; % Fetch the problem definition
options= problem.settings(100); % Get options and solver settings
[solution,MRHistory]=solveMyProblem( problem,guess,options);
[ tv, xv, uv ] = simulateSolution( problem, solution, 'ode113', 0.01 );
%% figure
xx=linspace(solution.T(1,1),solution.tf,1000);
figure
plot(xx,speval(solution,'X',2,xx),'b-' )
hold on
%plot(tv,xv(:,1),'k-.' )
xlabel('Time [s]')
ylabel('x(t)')
grid on
figure
hold on
plot(xx,speval(solution,'U',1,xx),'b-' )
plot(tv,uv(:,1),'k-.' )
%plot([solution.T(1,1); solution.tf],[problem.inputs.ul, problem.inputs.ul],'r-' )
%plot([solution.T(1,1); solution.tf],[problem.inputs.uu, problem.inputs.uu],'r-' )
xlabel('Time [s]')
grid on
ylabel('u(t)')