Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
writing optimization constraints in MATLAB involving function calls
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to solve following optimization problem:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168884/image.png)
I am using calculating θ1, θ2 and θ3 for every value of phi discretized between 30 deg. to 150 deg., using following function function thetas = inverse_kinematics_1(l1,l2,l3,phi)
x = 100;
y = 0;
x1 = x - (l3*cos(phi));
y1 = y - (l3*sin(phi));
a = sqrt(x1^2 + y1^2);
y2 = -y1/a;
x2 = -x1/a;
gamma = atan2(y2,x2);
c = (- x1^2 - y1^2 - l1^2 + l2^2)/(2*l1*a);
d = acos(c);
theta1 = gamma + d;
if theta1 < 0
theta1 = theta1 + 2*pi;
end
e = (y1 - l1*sin(theta1))/l2;
f = (x1 - l1*cos(theta1))/l2;
theta2 = atan2(e,f) - theta1;
if theta2 < 0
theta2 = theta2 + 2*pi;
end
theta3 = (phi)- (theta1 + theta2);
if theta3 < 0
theta3 = theta3 + 2*pi;
end
thetas = [theta1,theta2,theta3].*180/pi;
end
How can I write the constraints in this situation ?
0 Kommentare
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!