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

1 view (last 30 days)
Daniel Suarez on 25 Mar 2021
Answered: Alex Sha on 26 Mar 2021
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 CommentShowHide None
Daniel Suarez on 25 Mar 2021
How can I include the restction for x(2) in my code and hopefully get the result I want?

Sign in to comment.

### Answers (1)

Alex Sha on 26 Mar 2021
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
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!