How can I find maximum value of this function???

P1 = 25;
P2 = 37.5;
P3 = 20;
W1 = [5, 10];
W2 = [5, 10];
W3 = [5, 10];
L1 = [40, 60];
L2 = [25, 40];
L3 = [15, 25];
r1 = [6, 15];
r2 = [6, 15];
r3 = [6, 15];
T2 = [0.25*pi, 0.5*pi];
T3 = [0, 0.5*pi];
Fa = 1000
% Each moment arms
M1 = (P1^2+W1^2)/P1;
M2 = (P2^2+W2^2)/P2;
M3 = (P3^2+(sqrt((2*W3)^2-(P3-(L3-2*W3))^2)-W3)^2)/P3;
% Each contact Forces
PA = P3 + L2*cos(T3) + L1*cos(T2 + T3);
PB = P2 + L1*cost(T2);
F1 = (Fa*r1-F2*PB-F3*PA)/M1;
F2 = (Fa*r2-F3(P3+L2*cos(T3)))/M2;
F3 = (Fa*r3)/M3;
Favg = (F1+F2+F3)/3;
% Objective functions for the dimension optimization
d1 = F1+F2+F3;
d2 = (Favg-F1)^2+(Favg-F2)^2+(Favg-F3)^2;
fdim = (d1 + 1000/(1 + d2))
I need to find maximum value of 'fdim' when there are 8 variables have to considering.
Honestly, I have no idea of how to find it... I tried many times with several methods. But, I finally couldn't do this.
So, let me know how to find the maximum value of 'fdim'.

3 Comments

You are missing several variables, cost, Fa, r1, r2, r3. What are they?
Oh,, i'm sorry. I just miss it. Now, I add them. Thank you so much
PB = P2 + L1*cost(T2);
% I assume you mean:
PB = P2 + L1*cos(T2);

Sign in to comment.

 Accepted Answer

This is a brute force method.
P1 = 25;
P2 = 37.5;
P3 = 20;
W1 = [5, 10];
W2 = [5, 10];
W3 = [5, 10];
L1 = [40, 60];
L2 = [25, 40];
L3 = [15, 25];
r1 = [6, 15];
r2 = [6, 15];
r3 = [6, 15];
T2 = [0.25*pi, 0.5*pi];
T3 = [0, 0.5*pi];
Fa = 1000;
[p1,p2,p3,w1,w2,w3,l1,l2,l3,R1,R2,R3,t2,t3,fa]=ndgrid(P1,P2,P3,W1,W2,W3,L1,L2,L3,r1,r2,r3,T2,T3,Fa);
M1 = (p1.^2+w1.^2)./p1;
M2 = (p2.^2+w2.^2)./p2;
M3 = (p3.^2+(sqrt((2*w3).^2-(p3-(l3-2*w3)).^2)-w3).^2)./p3;
PA = p3 + l2.*cos(t3) + l1.*cos(t2 + t3);
PB = p2 + l1.*cos(t2);
F3 = (fa.*R3)./M3;
F2 = (Fa.*R2-F3.*(p3+l2.*cos(t3)))./M2;
F1 = (fa.*R1-F2.*PB-F3.*PA)./M1;
Favg = (F1+F2+F3)/3;
d1 = F1+F2+F3;
d2 = (Favg-F1).^2+(Favg-F2).^2+(Favg-F3).^2;
fdim = (d1 + 1000./(1 + d2));
Max=max(fdim,[],'all');%did you expect your calculations to go complex?

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!