Find all solutions of a system of equations

5 ビュー (過去 30 日間)
Pavel
Pavel 2014 年 5 月 4 日
コメント済み: Pavel 2014 年 5 月 5 日
I have a problem in which i need to find the maximum of the function "V". For those positive values to be the global maximum of the function, the three conditions c1, c2 and c3 must be positive. With the first values determined by solve function i dont't get the global maximum becuse c1, c2 and c3 are not verified. How do i get more solutions? This function has a global maximum. I'm pretty sure about that.
The code is:
if true
clear
clc
P=2000;
L=1300;
sa=150;
syms a b positive all
%se definesc lungimiile elementelor
l1=L/sin(45*pi/180);
l2=L/cos(a*pi/180);
l3=L/cos((a+b)*pi/180);
%eforturile din bare(la ridicarea nedeterminari)
N3(a,b)=(P*cos(a*pi/180))/(cos(a*pi/180)*sin((a+b)*pi/180)-(cos((a+b)*pi/180)*sin(a*pi/180)));
N2(a,b)=((-N3*cos((a+b)*pi/180)))/(cos(a*pi/180));
n3(a,b)=(-sin((a+45)*pi/180))/sin(b*pi/180);
n2(a,b)=(cos(45*pi/180)-n3*cos((a+b)*pi/180))/cos(a*pi/180);
%coeficientii ecuatiei canonice
D1F(a,b)=l2*n2*N2+l3*n3*N3;
d11(a,b)=l1+l2*n2*n2+l3*n3*n3;
%calcularea eforturilor nodale;
X1(a,b)=-D1F/d11;
X3(a,b)=(P*cos(a*pi/180)-X1*sin((45+a)*pi/180))/sin(b*pi/180);
X2(a,b)=(X1*cos(45*pi/180)-X3*cos((a+b)*pi/180))/cos(a*pi/180);
%functia obiectiv;
V(a,b)=(X1/sa)*l1+(X2/sa)*l2+(X3/sa)*l3;
%derivarea functiei obiectiv
diff_f1=diff(V,a);
diff_f2=diff(V,b);
%Calcularea valorilor numerice
[a, b]=solve(diff_f1, diff_f2)
%conditiilor de maxim global;
conditie1=diff(V,'a',2);
conditie2=diff(V, 'b', 2);
conditie3_1=diff(V, 'a', 'b');
conditie3=conditie1*conditie2-conditie3_1;
%verificarea conditiilor de maxim global
c1=double(conditie1(a,b))
c2=double(conditie2(a,b))
c3=double(conditie3(a,b))
if c1>0, c2>0, c3>0;
disp('Cele 3 condititii sunt verificate, astfel solutiile obtinute reprezinta punctul de maxim global')
end
%calcularea eforturilor nodale
F1=double(X1(a,b))
F2=double(X2(a,b))
F3=double(X3(a,b))
%Se verifica daca valorile obtinute pentru eforturile nodale verifica
%ecuatia de echilibru a fortelor pe directia Y
ver_ec=double(F1*sin(45*pi/180)+F2*sin(a*pi/180)+F3*sin((a+b)*pi/180)) end
  3 件のコメント
John D'Errico
John D'Errico 2014 年 5 月 4 日
Why do people feel it necessary to wrap their code with an "if true" block?
This is a waste of bits.
Image Analyst
Image Analyst 2014 年 5 月 4 日
John, it's because they clicked {}Code before they pasted their code in instead of after . It would be best if that button warned them to paste in code first, instead of putting in "if true" (Randy, are you listening?)

サインインしてコメントする。

回答 (1 件)

John D'Errico
John D'Errico 2014 年 5 月 4 日
編集済み: John D'Errico 2014 年 5 月 4 日
There is a global optimization toolbox. Use it.
If you don't have it and won't buy it, then start your optimizer with various random start points. Note that my rmsearch tool (found on the file exchange) does this for you.
  1 件のコメント
Pavel
Pavel 2014 年 5 月 5 日
I don't know how to use the global optimization toolbox. Could somenone give me some advices? Thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by