<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300</link>
    <title>MATLAB Central Newsreader - matrix generation</title>
    <description>Feed for thread: matrix generation</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 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.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sun, 08 Nov 2009 17:17:03 -0500</pubDate>
      <title>matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693038</link>
      <author>jack j</author>
      <description>Hi,&lt;br&gt;
I want to generate a 6x4 matrix of positive integers(max value:50) such that the difference between the 3rd element and 1st element in each row is 2 and difference of 2nd and 4th row element in all rows is 3.     &lt;br&gt;
Any help?</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 17:25:14 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693040</link>
      <author>dpb</author>
      <description>jack j wrote:&lt;br&gt;
&amp;gt; Hi, I want to generate a 6x4 matrix of positive integers(max&lt;br&gt;
&amp;gt; value:50) such that the difference between the 3rd element and 1st&lt;br&gt;
&amp;gt; element in each row is 2 and difference of 2nd and 4th row element in&lt;br&gt;
&amp;gt; all rows is 3. Any help?&lt;br&gt;
&lt;br&gt;
Generate (say) first and second columns then add 2 and 3, respectively. &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;You can ensure the condition by either rejecting greater&amp;gt;50 values &lt;br&gt;
and regenerating that pair or restrict the original rng range to &amp;lt;48 so &lt;br&gt;
sum can exceed 50.&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 17:39:02 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693041</link>
      <author>Miroslav Balda</author>
      <description>&quot;jack j&quot; &amp;lt;12mailjack@gmail.com&amp;gt; wrote in message &amp;lt;hd6uef$j43$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I want to generate a 6x4 matrix of positive integers(max value:50) such that the difference between the 3rd element and 1st element in each row is 2 and difference of 2nd and 4th row element in all rows is 3.     &lt;br&gt;
&amp;gt; Any help?&lt;br&gt;
&lt;br&gt;
Hi,&lt;br&gt;
&lt;br&gt;
Does it fit you?&lt;br&gt;
&lt;br&gt;
%   jack.m      2009-11-08&lt;br&gt;
%%%%%%%%%%%%&lt;br&gt;
A = zeros(6,4);&lt;br&gt;
A(:,1) = ceil(48*rand(6,1));&lt;br&gt;
A(:,3) = A(:,1)+2;&lt;br&gt;
A(:,4) = ceil(47*rand(6,1)+3);&lt;br&gt;
A(:,2) = A(:,4)-3&lt;br&gt;
&lt;br&gt;
Mira</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 17:53:01 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693043</link>
      <author>jack j</author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;hd6utr$jgr$2@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt; jack j wrote:&lt;br&gt;
&amp;gt; &amp;gt; Hi, I want to generate a 6x4 matrix of positive integers(max&lt;br&gt;
&amp;gt; &amp;gt; value:50) such that the difference between the 3rd element and 1st&lt;br&gt;
&amp;gt; &amp;gt; element in each row is 2 and difference of 2nd and 4th row element in&lt;br&gt;
&amp;gt; &amp;gt; all rows is 3. Any help?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Generate (say) first and second columns then add 2 and 3, respectively. &lt;br&gt;
&amp;gt;     You can ensure the condition by either rejecting greater&amp;gt;50 values &lt;br&gt;
&amp;gt; and regenerating that pair or restrict the original rng range to &amp;lt;48 so &lt;br&gt;
&amp;gt; sum can exceed 50.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --&lt;br&gt;
&lt;br&gt;
Did u mean a random number generation in a 'for' loop or a 6x2 random matrix generation and then a concatenation?</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 17:59:02 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693045</link>
      <author>jack j</author>
      <description>&quot;Miroslav Balda&quot; &amp;lt;miroslav.nospam@balda.cz&amp;gt; wrote in message &amp;lt;hd6vnm$7u3$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;jack j&quot; &amp;lt;12mailjack@gmail.com&amp;gt; wrote in message &amp;lt;hd6uef$j43$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; I want to generate a 6x4 matrix of positive integers(max value:50) such that the difference between the 3rd element and 1st element in each row is 2 and difference of 2nd and 4th row element in all rows is 3.     &lt;br&gt;
&amp;gt; &amp;gt; Any help?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Does it fit you?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %   jack.m      2009-11-08&lt;br&gt;
&amp;gt; %%%%%%%%%%%%&lt;br&gt;
&amp;gt; A = zeros(6,4);&lt;br&gt;
&amp;gt; A(:,1) = ceil(48*rand(6,1));&lt;br&gt;
&amp;gt; A(:,3) = A(:,1)+2;&lt;br&gt;
&amp;gt; A(:,4) = ceil(47*rand(6,1)+3);&lt;br&gt;
&amp;gt; A(:,2) = A(:,4)-3&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Mira&lt;br&gt;
&lt;br&gt;
Thankx Mira, it works....and thanks dpb......</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 18:10:24 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693047</link>
      <author>dpb</author>
      <description>jack j wrote:&lt;br&gt;
&amp;gt; &quot;Miroslav Balda&quot; &amp;lt;miroslav.nospam@balda.cz&amp;gt; wrote in message &amp;lt;hd6vnm$7u3$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; &quot;jack j&quot; &amp;lt;12mailjack@gmail.com&amp;gt; wrote in message &amp;lt;hd6uef$j43$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Hi,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; I want to generate a 6x4 matrix of positive integers(max value:50) such that the difference between the 3rd element and 1st element in each row is 2 and difference of 2nd and 4th row element in all rows is 3.     &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Any help?&lt;br&gt;
&amp;gt;&amp;gt; Hi,&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Does it fit you?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; %   jack.m      2009-11-08&lt;br&gt;
&amp;gt;&amp;gt; %%%%%%%%%%%%&lt;br&gt;
&amp;gt;&amp;gt; A = zeros(6,4);&lt;br&gt;
&amp;gt;&amp;gt; A(:,1) = ceil(48*rand(6,1));&lt;br&gt;
&amp;gt;&amp;gt; A(:,3) = A(:,1)+2;&lt;br&gt;
&amp;gt;&amp;gt; A(:,4) = ceil(47*rand(6,1)+3);&lt;br&gt;
&amp;gt;&amp;gt; A(:,2) = A(:,4)-3&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Mira&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thankx Mira, it works....and thanks dpb......&lt;br&gt;
&lt;br&gt;
Yes, precisely what I suggested altho he chose 1 and 4 as the two &lt;br&gt;
independent and did a little finer pruning on the upper bounds than a &lt;br&gt;
single limit.&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 18:37:01 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693049</link>
      <author>jack j</author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;hd71ii$9sb$1@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt; jack j wrote:&lt;br&gt;
&amp;gt; &amp;gt; &quot;Miroslav Balda&quot; &amp;lt;miroslav.nospam@balda.cz&amp;gt; wrote in message &amp;lt;hd6vnm$7u3$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &quot;jack j&quot; &amp;lt;12mailjack@gmail.com&amp;gt; wrote in message &amp;lt;hd6uef$j43$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; I want to generate a 6x4 matrix of positive integers(max value:50) such that the difference between the 3rd element and 1st element in each row is 2 and difference of 2nd and 4th row element in all rows is 3.     &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; Any help?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Does it fit you?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; %   jack.m      2009-11-08&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; %%%%%%%%%%%%&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; A = zeros(6,4);&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; A(:,1) = ceil(48*rand(6,1));&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; A(:,3) = A(:,1)+2;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; A(:,4) = ceil(47*rand(6,1)+3);&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; A(:,2) = A(:,4)-3&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Mira&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thankx Mira, it works....and thanks dpb......&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Yes, precisely what I suggested altho he chose 1 and 4 as the two &lt;br&gt;
&amp;gt; independent and did a little finer pruning on the upper bounds than a &lt;br&gt;
&amp;gt; single limit.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --&lt;br&gt;
&lt;br&gt;
But what if the condition is something like &quot; (1st column element-2nd column element)+(3rd column element-4th column element)&quot;for all rows should be equal to x???&lt;br&gt;
&lt;br&gt;
In this case will such a defn work out?</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 19:05:05 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693056</link>
      <author>jack j</author>
      <description>&lt;br&gt;
&amp;gt; But what if the condition is something like &quot; (1st column element-2nd column element)+(3rd column element-4th column element)&quot;for all rows should be equal to x???&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In this case will such a defn work out?&lt;br&gt;
&lt;br&gt;
If the condition is &quot;(1st column element-2nd column element)+(3rd column element-4th column element)&quot; should be a number greater than 'x', then also I doubt whether such a column by column definition will work.&lt;br&gt;
&lt;br&gt;
Please help.....</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 19:09:16 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693057</link>
      <author>dpb</author>
      <description>jack j wrote:&lt;br&gt;
...&lt;br&gt;
&amp;gt; But what if the condition is something like &quot; (1st column element-2nd&lt;br&gt;
&amp;gt; column element)+(3rd column element-4th column element)&quot;for all rows&lt;br&gt;
&amp;gt; should be equal to x???&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In this case will such a defn work out?&lt;br&gt;
&lt;br&gt;
Possibly depending on the size of the selection pool and value of x. &lt;br&gt;
The rudimentary case for the above would be generate three independently &lt;br&gt;
and solve for the fourth as the parentheses make no difference &lt;br&gt;
numerically to the overall sum (and since you didn't state any other &lt;br&gt;
condition).&lt;br&gt;
&lt;br&gt;
You'll have the same problem of occasionally (or more than occasionally, &lt;br&gt;
perhaps) having to resample; whether that's acceptable or not on the &lt;br&gt;
required population statistics or not is another question you'd have to &lt;br&gt;
judge.&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 19:20:07 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693059</link>
      <author>dpb</author>
      <description>dpb wrote:&lt;br&gt;
&amp;gt; jack j wrote:&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt;&amp;gt; But what if the condition is something like &quot; (1st column element-2nd&lt;br&gt;
&amp;gt;&amp;gt; column element)+(3rd column element-4th column element)&quot;for all rows&lt;br&gt;
&amp;gt;&amp;gt; should be equal to x???&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; In this case will such a defn work out?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Possibly depending on the size of the selection pool and value of x. The &lt;br&gt;
&amp;gt; rudimentary case for the above would be generate three independently and &lt;br&gt;
&amp;gt; solve for the fourth as the parentheses make no difference numerically &lt;br&gt;
&amp;gt; to the overall sum (and since you didn't state any other condition).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You'll have the same problem of occasionally (or more than occasionally, &lt;br&gt;
&amp;gt; perhaps) having to resample; whether that's acceptable or not on the &lt;br&gt;
&amp;gt; required population statistics or not is another question you'd have to &lt;br&gt;
&amp;gt; judge.&lt;br&gt;
&lt;br&gt;
NOTA BENE:  In the above I assumed the &quot;for all rows&quot; means each row &lt;br&gt;
independently satisfies the criterion.&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Mon, 09 Nov 2009 03:55:18 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693133</link>
      <author>jack j</author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;hd75l9$alt$2@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt; dpb wrote:&lt;br&gt;
&amp;gt; &amp;gt; jack j wrote:&lt;br&gt;
&amp;gt; &amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; But what if the condition is something like &quot; (1st column element-2nd&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; column element)+(3rd column element-4th column element)&quot;for all rows&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; should be equal to x???&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; In this case will such a defn work out?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Possibly depending on the size of the selection pool and value of x. The &lt;br&gt;
&amp;gt; &amp;gt; rudimentary case for the above would be generate three independently and &lt;br&gt;
&amp;gt; &amp;gt; solve for the fourth as the parentheses make no difference numerically &lt;br&gt;
&amp;gt; &amp;gt; to the overall sum (and since you didn't state any other condition).&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; You'll have the same problem of occasionally (or more than occasionally, &lt;br&gt;
&amp;gt; &amp;gt; perhaps) having to resample; whether that's acceptable or not on the &lt;br&gt;
&amp;gt; &amp;gt; required population statistics or not is another question you'd have to &lt;br&gt;
&amp;gt; &amp;gt; judge.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; NOTA BENE:  In the above I assumed the &quot;for all rows&quot; means each row &lt;br&gt;
&amp;gt; independently satisfies the criterion.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --&lt;br&gt;
&lt;br&gt;
Yes, each row should independently satisfy the criterion.&lt;br&gt;
What happens with the following condition?&lt;br&gt;
(1st column element-2nd column element)^2+(3rd column element-4th column element)^2 should be greater than x.</description>
    </item>
    <item>
      <pubDate>Mon, 09 Nov 2009 05:52:15 -0500</pubDate>
      <title>Re: matrix generation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265300#693140</link>
      <author>dpb</author>
      <description>jack j wrote:&lt;br&gt;
...&lt;br&gt;
&amp;gt; Yes, each row should independently satisfy the criterion.&lt;br&gt;
&amp;gt; What happens with the following condition?&lt;br&gt;
&amp;gt; (1st column element-2nd column element)^2+(3rd column element-4th&lt;br&gt;
&amp;gt; column element)^2 should be greater than x.&lt;br&gt;
&lt;br&gt;
What is this, 20 questions?&lt;br&gt;
&lt;br&gt;
Work out the necessary algebra...&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
  </channel>
</rss>

