MATLAB Answers

How to include contratins on 1 variables for this nonlinear system of equations?

1 ビュー (過去 30 日間)
Daniel Suarez
Daniel Suarez 2021 年 3 月 25 日
回答済み: Alex Sha 2021 年 3 月 26 日
I am trying to solve a nonlinear system of 3 equations for which i need to include contraints for 1 variables x(2), where:
1/4 less or equal than x(2), and also x(2) less than 1/3
I have the following code:
function S = myfun(x)
%betai = x(1)
%a = x(2)
%aprime = x(3)
S=[((2.1123 * cos(x(1)))/(8 * pi * (sin(x(1))^2)) * (1 + 0.0163 * tan(x(1))) - x(2)/(1-x(2)));
(2.1123 /(8 * pi * cos(x(1)))) * (1 - 0.0163 * cot(x(1))) - (x(3)/(1+x(3)));
tan(x(1)) - (1-x(2))/(1.4 * (1+x(3)))];
end
d0 = [23.69, 0, 0];
solution = fsolve(@myfun, d0)
And I get this solution: (which is not the one I need)
solution =
25.1041 0.9904 0.1542
  1 件のコメント
Daniel Suarez
Daniel Suarez 2021 年 3 月 25 日
How can I include the restction for x(2) in my code and hopefully get the result I want?

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

回答 (1 件)

Alex Sha
Alex Sha 2021 年 3 月 26 日
Hi, refer to the solutions below:
1:
x1: 0.415757622422666
x2: 0.321911265108838
x3: 0.0970690621849188
2:
x1: 12.9821282367818
x2: 0.321911265108838
x3: 0.097069062184919
3:
x1: 19.2653135439614
x2: 0.321911265108837
x3: 0.0970690621849187
Multi-values for x1

Community Treasure Hunt

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

Start Hunting!

Translated by