The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Real negative odd roots
Replies: 1   Last Post: Jan 28, 2014 11:58 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 14
Registered: 12/18/13
Real negative odd roots
Posted: Jan 28, 2014 8:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 :

for i=1:length(rtemp)
if(isreal(rtemp(i)==1) && (rtemp(i)<0))
rneg = [rneg rtemp(i)];

rneg =

-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!

Date Subject Author
Read Real negative odd roots
Read Real negative odd roots

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.