Hello, for any roots i need to create a script that the output will be only the real negative odd roots.
For example: rtemp = [-8 -8 -8 -8 4 -1 3]
to choose only real negative roots (there are some cases when the roots are complex, so i don't want complex roots :
rneg=; for i=1:length(rtemp) if(isreal(rtemp(i)==1) && (rtemp(i)<0)) rneg = [rneg rtemp(i)]; end end
-8 -8 -8 -8 -1
Now i only want only the odd roots. In this example -8 is an even root (4 times) and -1 is odd, so the output will be only -1. If rtemp = [-8 -8 -8 4 -1 3], the -8 will be an odd root (3 times) so the output will be [-1 -8]. How can i write to have only the odd roots? Thank you!