I do not know how to remove complex roots from an equation (or even if it is possible.) The problem reads, "The product of three integers with spacing of 5 between them (e.g., 9, 14, 19) is 10,098. Using Matlab's built-in function for operations with polynomials, determine the three integers."
The three integers are 17, 22, and 27. My prof wants us to use the conv() and roots() command. He also said "we are ONLY concerned with real integer solutions." I would imagine he wants the output to be 17, 22 and 27 only. I need a way to either remove the complex roots, or tweak my code to only give the three real integer solutions. Below is my code. Below that are the solutions given my Matlab. Any help would be great.
a=[1 0] b=[1 5] c=[1 10]
d=f+[0 0 0 -10098]
r=roots(d) %first root
r+5 %second root
r+10 %third root
-16.0000 +18.3848i-16.0000 -18.3848i17.0000 + 0.0000i
-11.0000 +18.3848i-11.0000 -18.3848i22.0000 + 0.0000i
-6.0000 +18.3848i-6.0000 -18.3848i27.0000 + 0.0000i