<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.co.kr/matlabcentral/newsreader/view_thread/317850</link>
    <title>MATLAB Central Newsreader - Sort complex numbers according to their signs...</title>
    <description>Feed for thread: Sort complex numbers according to their signs...</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.co.kr/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sun, 11 Mar 2012 15:58:12 +0000</pubDate>
      <title>Sort complex numbers according to their signs...</title>
      <link>http://www.mathworks.co.kr/matlabcentral/newsreader/view_thread/317850#869614</link>
      <author>Florent Kadrija</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
as I am new to matlab so I need your help. I want so sort, let say this vector of complex symbols according to their signs: for instance consider:&lt;br&gt;
a=0.4681 + 0.3268i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.6969 - 0.6949i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.6662 - 0.6710i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.6428 + 0.6534i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.5679 - 0.6836i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.6971 + 0.7041i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.5564 - 0.6839i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.5863 + 0.6813i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.5791 - 0.6611i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.3268 + 0.6967i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.6055 + 0.6077i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.6975 - 0.5981i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.6832 + 0.5515i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.5244 - 0.7060i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.7041 - 0.5799i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.6681 + 0.7046i&lt;br&gt;
&amp;nbsp;&amp;nbsp;-0.6560 - 0.6955i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.6029 + 0.5291i&lt;br&gt;
&lt;br&gt;
there are 4 possibilities: &lt;br&gt;
1. a=b+jc&lt;br&gt;
2. a=b-jc&lt;br&gt;
3. a=-b+jc&lt;br&gt;
4. a=-b-jc&lt;br&gt;
&lt;br&gt;
What I want is to sort all the complex symbols from vector a in the above given order. Can any body help me doing this???&lt;br&gt;
&lt;br&gt;
Ann after sorting in the given order the next step is to mapp these symbols in the given order, for instance:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;1     0     2     0     1     2     0     3     3     1     1 &lt;br&gt;
&lt;br&gt;
which means that all complex number are mapped according to:&lt;br&gt;
&lt;br&gt;
1. a=b+jc ---&amp;gt; 0&lt;br&gt;
2. a=b-jc ---&amp;gt; 1&lt;br&gt;
3. a=-b+jc ---&amp;gt;2&lt;br&gt;
4. a=-b-jc--&amp;gt; 3&lt;br&gt;
&lt;br&gt;
Is this possible to do, and can anybody give me an Idea or help me how to do this...&lt;br&gt;
&lt;br&gt;
Thanks in advance,&lt;br&gt;
Flori</description>
    </item>
    <item>
      <pubDate>Sun, 11 Mar 2012 20:10:12 +0000</pubDate>
      <title>Re: Sort complex numbers according to their signs...</title>
      <link>http://www.mathworks.co.kr/matlabcentral/newsreader/view_thread/317850#869633</link>
      <author>Roger Stafford</author>
      <description>"Florent Kadrija" &amp;lt;florent.kadrija@gmail.com&amp;gt; wrote in message &amp;lt;jjii2k$ht1$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; as I am new to matlab so I need your help. I want so sort, let say this vector of complex symbols according to their signs: for instance consider:&lt;br&gt;
&amp;gt; a=0.4681 + 0.3268i&lt;br&gt;
&amp;gt;   -0.6969 - 0.6949i&lt;br&gt;
&amp;gt;   -0.6662 - 0.6710i&lt;br&gt;
&amp;gt;    0.6428 + 0.6534i&lt;br&gt;
&amp;gt;   -0.5679 - 0.6836i&lt;br&gt;
&amp;gt;    0.6971 + 0.7041i&lt;br&gt;
&amp;gt;    0.5564 - 0.6839i&lt;br&gt;
&amp;gt;    0.5863 + 0.6813i&lt;br&gt;
&amp;gt;   -0.5791 - 0.6611i&lt;br&gt;
&amp;gt;   -0.3268 + 0.6967i&lt;br&gt;
&amp;gt;   -0.6055 + 0.6077i&lt;br&gt;
&amp;gt;    0.6975 - 0.5981i&lt;br&gt;
&amp;gt;    0.6832 + 0.5515i&lt;br&gt;
&amp;gt;   -0.5244 - 0.7060i&lt;br&gt;
&amp;gt;   -0.7041 - 0.5799i&lt;br&gt;
&amp;gt;    0.6681 + 0.7046i&lt;br&gt;
&amp;gt;   -0.6560 - 0.6955i&lt;br&gt;
&amp;gt;    0.6029 + 0.5291i&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; there are 4 possibilities: &lt;br&gt;
&amp;gt; 1. a=b+jc&lt;br&gt;
&amp;gt; 2. a=b-jc&lt;br&gt;
&amp;gt; 3. a=-b+jc&lt;br&gt;
&amp;gt; 4. a=-b-jc&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What I want is to sort all the complex symbols from vector a in the above given order. Can any body help me doing this???&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Ann after sorting in the given order the next step is to mapp these symbols in the given order, for instance:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  1     0     2     0     1     2     0     3     3     1     1 &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which means that all complex number are mapped according to:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 1. a=b+jc ---&amp;gt; 0&lt;br&gt;
&amp;gt; 2. a=b-jc ---&amp;gt; 1&lt;br&gt;
&amp;gt; 3. a=-b+jc ---&amp;gt;2&lt;br&gt;
&amp;gt; 4. a=-b-jc--&amp;gt; 3&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Is this possible to do, and can anybody give me an Idea or help me how to do this...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks in advance,&lt;br&gt;
&amp;gt; Flori&lt;br&gt;
- - - - - - - - -&lt;br&gt;
&amp;nbsp;mapp = (imag(a)&amp;lt;0) + 2*(real(a)&amp;lt;0);&lt;br&gt;
&amp;nbsp;[~,p] = sort(mapp);&lt;br&gt;
&amp;nbsp;a_sorted = a(p);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Note: I have assumed here that you want no sorting other than by the signs in the real and imaginary parts.  Also I assume that when either of these parts is zero, the corresponding sign is plus.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Sun, 11 Mar 2012 20:26:13 +0000</pubDate>
      <title>Re: Sort complex numbers according to their signs...</title>
      <link>http://www.mathworks.co.kr/matlabcentral/newsreader/view_thread/317850#869634</link>
      <author>Florent Kadrija</author>
      <description>"Roger Stafford" wrote in message &amp;lt;jjj0r4$js$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Florent Kadrija" &amp;lt;florent.kadrija@gmail.com&amp;gt; wrote in message &amp;lt;jjii2k$ht1$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; as I am new to matlab so I need your help. I want so sort, let say this vector of complex symbols according to their signs: for instance consider:&lt;br&gt;
&amp;gt; &amp;gt; a=0.4681 + 0.3268i&lt;br&gt;
&amp;gt; &amp;gt;   -0.6969 - 0.6949i&lt;br&gt;
&amp;gt; &amp;gt;   -0.6662 - 0.6710i&lt;br&gt;
&amp;gt; &amp;gt;    0.6428 + 0.6534i&lt;br&gt;
&amp;gt; &amp;gt;   -0.5679 - 0.6836i&lt;br&gt;
&amp;gt; &amp;gt;    0.6971 + 0.7041i&lt;br&gt;
&amp;gt; &amp;gt;    0.5564 - 0.6839i&lt;br&gt;
&amp;gt; &amp;gt;    0.5863 + 0.6813i&lt;br&gt;
&amp;gt; &amp;gt;   -0.5791 - 0.6611i&lt;br&gt;
&amp;gt; &amp;gt;   -0.3268 + 0.6967i&lt;br&gt;
&amp;gt; &amp;gt;   -0.6055 + 0.6077i&lt;br&gt;
&amp;gt; &amp;gt;    0.6975 - 0.5981i&lt;br&gt;
&amp;gt; &amp;gt;    0.6832 + 0.5515i&lt;br&gt;
&amp;gt; &amp;gt;   -0.5244 - 0.7060i&lt;br&gt;
&amp;gt; &amp;gt;   -0.7041 - 0.5799i&lt;br&gt;
&amp;gt; &amp;gt;    0.6681 + 0.7046i&lt;br&gt;
&amp;gt; &amp;gt;   -0.6560 - 0.6955i&lt;br&gt;
&amp;gt; &amp;gt;    0.6029 + 0.5291i&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; there are 4 possibilities: &lt;br&gt;
&amp;gt; &amp;gt; 1. a=b+jc&lt;br&gt;
&amp;gt; &amp;gt; 2. a=b-jc&lt;br&gt;
&amp;gt; &amp;gt; 3. a=-b+jc&lt;br&gt;
&amp;gt; &amp;gt; 4. a=-b-jc&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; What I want is to sort all the complex symbols from vector a in the above given order. Can any body help me doing this???&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Ann after sorting in the given order the next step is to mapp these symbols in the given order, for instance:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;  1     0     2     0     1     2     0     3     3     1     1 &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; which means that all complex number are mapped according to:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; 1. a=b+jc ---&amp;gt; 0&lt;br&gt;
&amp;gt; &amp;gt; 2. a=b-jc ---&amp;gt; 1&lt;br&gt;
&amp;gt; &amp;gt; 3. a=-b+jc ---&amp;gt;2&lt;br&gt;
&amp;gt; &amp;gt; 4. a=-b-jc--&amp;gt; 3&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Is this possible to do, and can anybody give me an Idea or help me how to do this...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks in advance,&lt;br&gt;
&amp;gt; &amp;gt; Flori&lt;br&gt;
&amp;gt; - - - - - - - - -&lt;br&gt;
&amp;gt;  mapp = (imag(a)&amp;lt;0) + 2*(real(a)&amp;lt;0);&lt;br&gt;
&amp;gt;  [~,p] = sort(mapp);&lt;br&gt;
&amp;gt;  a_sorted = a(p);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Note: I have assumed here that you want no sorting other than by the signs in the real and imaginary parts.  Also I assume that when either of these parts is zero, the corresponding sign is plus.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Thanks a lot for your advice.</description>
    </item>
  </channel>
</rss>
