Non Linear Optimization using Fmincon

Hello,
I am trying to do nonlinear optimization using fmincon in matlab. I don't have much experience with this specific topic and was curious if anyone could help me implement this into matlab.
I have to minimize -ls1 subject to lc1-1=0, lc2-1=0,... lc9-1=0, ls2-ls1=0, ls3-ls1=0.
I have equations to calculate all of these values and can change the values r and theta. Any help at all would be appreciated I have hit a brick wall on this problem
r = 1; % Define the radius
adjust = 25; % Adjust the twist angle
height =1; % Define the height
theta1 = linspace(90,330,3); % Bottom theta values
theta2 = linspace(theta1(1)+adjust,theta1(end)+adjust,3); % Top theta values
theta = [theta1,theta2]; % Combine for ease of use
M_Ls1 = height^2+2*r^2*(1-(cosd(theta(1))*cosd(theta(5)))-(sind(theta(1))*sind(theta(5))));
M_Ls2 = height^2+2*r^2*(1-(cosd(theta(2))*cosd(theta(6)))-(sind(theta(2))*sind(theta(6))));
M_Ls3 = height^2+2*r^2*(1-(cosd(theta(3))*cosd(theta(4)))-(sind(theta(3))*sind(theta(4))));
M_Lc1 = 2*r^2*(1-(cosd(theta(1))*cosd(theta(2)))-(sind(theta(1))*sind(theta(2))));
M_Lc2 = 2*r^2*(1-(cosd(theta(1))*cosd(theta(3)))-(sind(theta(1))*sind(theta(3))));
M_Lc3 = height^2 + 2*r^2*(1-(cosd(theta(1))*cosd(theta(4)))-(sind(theta(1))*sind(theta(4))));
M_Lc4 = 2*r^2*(1-(cosd(theta(2))*cosd(theta(3)))-(sind(theta(2))*sind(theta(3))));
M_Lc5 = height^2 + 2*r^2*(1-(cosd(theta(2))*cosd(theta(5)))-(sind(theta(2))*sind(theta(5))));
M_Lc6 = height^2 + 2*r^2*(1-(cosd(theta(3))*cosd(theta(6)))-(sind(theta(3))*sind(theta(6))));
M_Lc7 = 2*r^2*(1-(cosd(theta(4))*cosd(theta(5)))-(sind(theta(4))*sind(theta(5))));
M_Lc8 = 2*r^2*(1-(cosd(theta(4))*cosd(theta(6)))-(sind(theta(4))*sind(theta(6))));
M_Lc9 = 2*r^2*(1-(cosd(theta(5))*cosd(theta(6)))-(sind(theta(5))*sind(theta(6))));

댓글 수: 1

Divija Aleti
Divija Aleti 2020년 12월 4일
Hi,
Can I know with respect to what variable you want to minimize -ls1 ? Also, what do you mean by 'the values of r and theta can be changed?'

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Nonlinear Control에 대해 자세히 알아보기

제품

질문:

2020년 11월 26일

댓글:

2020년 12월 4일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by