Hi. I want to solve aforementioned equation in octave

My aim to find Y2 answer. When I do manual calculation, the answer for Y2 shall have 3 answer,

but when I do in octave I cant get 3 answer when using looping. My code as per below:

Assume shape 1 choosen

```
%TRY
shape=input ('Please key in Shape Number 1,2,3,4:')
Yo=0.715
sg=9.81
Area=1.859
base=2.6
Q=9.8
height=0.31
yc=1.131
%DETERMINE CAPABILITY OF WEIR BY COMPARING height of weir & Critical Height
%Calculate hc=Eo-Emin
Eo=Yo+((Q^2)/(2*sg*(Area^2)))
Emin=(3/2)*(yc)
hc=Eo-Emin;
%Compare hc & height
if height<hc
disp('This Section Case 1')
Y1=Yo
Y3=Yo
E1=Eo
E3=Eo
E2=Eo-height
%Calculate Y2
if shape==1
disp('Use Area Rectangular, To find Y2')
Y2=0.001;1
while Y2<10
LHSA=Y2
LHSB=(Q^2)/(2*sg*((base*(Y2^2))))
LHS=LHSA+LHSB
RHS=E2
if (LHS>=RHS)
answer_Y2=Y2;
fprintf('Y2 = %-3.4f\n',answer_Y2)
break;
end
Y2=Y2+0.001;
end
elseif shape==2
disp('Use Area Triangular, To find Y2')
elseif shape==3
disp('Use Area Trapezoidal, To find Y2')
elseif shape==4
disp('Use Area Circular, To find Y2')
else
disp('Error Shape, To find Y2')
end
elseif height=hc
disp('height=hc')
elseif height>hc
disp('height>hc')
else
disp('Error')
end
```