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

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by