MATLAB: Am I not getting two values for the output

functionsMATLAB

I am trying to write a function that gives me the roots of a quadratic function (ax^2+bc+c), but my vurrent function only gives me a single answer and I cant figure out why.
function [y1,y2] = QuadFor(x1,x2,x3)
y1 = -x2 + [sqrt(x2^2 – 4*x1*x3)] / (2*x1);
y2 = -x2 – [sqrt(x2^2 – 4*x1*x3)] / (2*x1);
end;

Best Answer

An example:
x1= 2;
x2=4;
x3=6;
[y1,y2] = QuadFor(x1,x2,x3) %function call
function [y1,y2] = QuadFor(x1,x2,x3) %function definition
y1 = -x2 + [sqrt(x2^2 - 4*x1*x3)] / (2*x1);
y2 = -x2 - [sqrt(x2^2 - 4*x1*x3)] / (2*x1);
end
command window:
>> COMMUNITY
y1 =
-4 + 1393/985i
y2 =
-4 - 1393/985i
>>