• 大小: 224KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-05-22
  • 语言: Matlab
  • 标签:

资源简介

Control vector parameterization, also known as direct sequential method, is one of the direct optimization methods for solving optimal control problems. The basic idea of direct optimization methods is to discretize the control problem, and then apply nonlinear programming (NLP) techniques to the resulting finite-dimensional optimization problem. Contents • Problem Statement • Parameter Configurations • Piecewise constant control • Continuous linear spline control

资源截图

代码片段和文件信息

function M = animateopt( toptxoptuoptthetaoptbetaNrho )
%ANIMATEOPT animate the optimal state trajectory
[toptu idx] = unique(topt);
xoptu = xopt(idx:); %unique(xopt‘rows‘);
uoptu = uopt(idx);
thetaoptu = thetaopt(idx); % remove duplicate values
t = 0:0.1:6;
xoi = interp1(toptuxoptut);
uoi = interp1(toptuuoptut); % trust $u$
haoi = atan(xoi(:4)./xoi(:3)); % heading angle
haoi(1) = haoi(2);
toi = interp1(toptuthetaoptut); % trust angle $\theta$
[xy] = meshgrid(-1:0.5:5);
fx = (beta*(3-x))./((y.^2+(x-3).^2).^(3/2));
fy = (-beta*y)./((y.^2+(x-3).^2).^(3/2));
figure;
for k=1:length(t)
    % contruct the shape of a boat around the point with respect to 
    % heading angle
    bx= xoi(k1)+ [0.2*cos(haoi(k)-0.5) 0.3*cos(haoi(k)) ...
        0.2*cos(haoi(k)+0.5) 0.2*cos(haoi(k)-0.5) ...
        -0.2*cos(haoi(k)+0.5) -0.3*cos(haoi(k)) ...
        -0.2*cos(haoi(k)-0.5) -0.2*cos(haoi(k)+0.5) ...
        -0.2*cos(haoi(k)-0.5) 0.2*cos(haoi(k)+0.5)];
    by= xoi(k2)+ [0.2*sin(haoi(k)-0.5) 0.3*sin(haoi(k)) ...
        0.2*sin(haoi(k)+0.5) 0.2*sin(haoi(k)-0.5) ...
        -0.2*sin(haoi(k)+0.5) -0.3*sin(haoi(k)) ...
        -0.2*sin(haoi(k)-0.5) -0.2*sin(haoi(k)+0.5) ...
        -0.2*sin(haoi(k)-0.5) 0.2*sin(haoi(k)+0.5)];
    plot(xoi(1:k1)xoi(1:k2)‘b-‘bxby‘b-‘[0 3 4][0 0 4]‘ko‘...
    [xoi(k1)xoi(k1)+uoi(k)/max(abs(uoptu))*cos(toi(k))]...
        [xoi(k2)xoi(k2)+uoi(k)/max(abs(uoptu))*sin(toi(k))]...
        ‘r:‘‘LineWidth‘2); % using red dotted line to denote direction of
    % the trust and its length is proportional to the control effort $u$
    hold on;quiver(xyfxfy1‘LineWidth‘2‘Color‘‘black‘);hold off
    xlabel(‘x_1(t)‘‘fontsize‘14)
    ylabel(‘x_2(t)‘‘fontsize‘14)
    set(gca‘FontSize‘12)
    title([‘\beta=‘int2str(beta)‘ N=‘int2str(N)‘ \rho=‘int2str(rho)])
    xlim([-1 5]);ylim([-1 5]);
    axis square;
    M(k) = getframe(gcf);
end
end


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-04-27 13:00  Optimal_Control\
     文件      138389  2020-03-13 22:47  Optimal_Control\Optimal Control Using Control Vector Parameterization.docx
     文件        1969  2012-12-18 23:35  Optimal_Control\animateopt.m
     文件         351  2012-12-18 23:10  Optimal_Control\confun1.m
     文件         365  2012-12-18 23:13  Optimal_Control\confun2.m
     文件         247  2012-04-16 11:29  Optimal_Control\costfun1.m
     文件         259  2012-04-16 11:29  Optimal_Control\costfun2.m
     文件         354  2012-04-16 11:30  Optimal_Control\dyneqn1.m
     文件         461  2012-04-16 11:30  Optimal_Control\dyneqn2.m
     目录           0  2020-03-10 12:47  Optimal_Control\html\
     文件       21242  2012-12-19 03:22  Optimal_Control\html\mainproc.html
     文件        2611  2012-12-19 03:22  Optimal_Control\html\mainproc.png
     文件        6632  2012-12-19 03:18  Optimal_Control\html\mainproc_01.png
     文件        4447  2012-12-19 03:18  Optimal_Control\html\mainproc_02.png
     文件        4342  2012-12-19 03:18  Optimal_Control\html\mainproc_03.png
     文件        6635  2012-12-19 03:18  Optimal_Control\html\mainproc_04.png
     文件        6665  2012-12-19 03:22  Optimal_Control\html\mainproc_05.png
     文件        5947  2012-12-19 03:22  Optimal_Control\html\mainproc_06.png
     文件        6066  2012-12-19 03:22  Optimal_Control\html\mainproc_07.png
     文件        6678  2012-12-19 03:22  Optimal_Control\html\mainproc_08.png
     文件        3232  2012-12-17 22:53  Optimal_Control\html\mainproc_eq04112.png
     文件         460  2012-12-18 04:56  Optimal_Control\html\mainproc_eq05153.png
     文件         377  2012-12-17 22:25  Optimal_Control\html\mainproc_eq06004.png
     文件        1238  2012-12-17 22:25  Optimal_Control\html\mainproc_eq08269.png
     文件        2868  2012-12-17 22:53  Optimal_Control\html\mainproc_eq08551.png
     文件        7994  2012-12-17 23:00  Optimal_Control\html\mainproc_eq17708.png
     文件         813  2012-12-17 22:30  Optimal_Control\html\mainproc_eq19825.png
     文件         314  2012-12-18 04:56  Optimal_Control\html\mainproc_eq20099.png
     文件         813  2012-12-17 22:33  Optimal_Control\html\mainproc_eq33539.png
     文件         277  2012-12-17 22:25  Optimal_Control\html\mainproc_eq35435.png
     文件        1827  2012-12-17 22:32  Optimal_Control\html\mainproc_eq39630.png
............此处省略18个文件信息

评论

共有 条评论

相关资源