<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263245</link>
    <title>MATLAB Central Newsreader - Testing if vector x is twice vector y</title>
    <description>Feed for thread: Testing if vector x is twice vector y</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>Thu, 15 Oct 2009 18:53:03 -0400</pubDate>
      <title>Testing if vector x is twice vector y</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263245#687361</link>
      <author>El Hassan Abdel Fattah</author>
      <description>hello all,&lt;br&gt;
&lt;br&gt;
im a university student and currently im taking a matlab course this term. i got an assignment due tomorrow and needed some help:&lt;br&gt;
&lt;br&gt;
if we have two variables:&lt;br&gt;
&lt;br&gt;
x = [4; 1; 4; 6; 2]&lt;br&gt;
y = [3; 9; 2; 3; 1]&lt;br&gt;
&lt;br&gt;
question is as follows: Test if all the elements of x are twice as big as the corresponding elements in y OR any element of x is less than the corresponding element of y.&lt;br&gt;
&lt;br&gt;
given hint: use the functions 'all( )' and 'any( )' and logic operators ('|', single vertical bar) for vectors.&lt;br&gt;
&lt;br&gt;
Thanks for anyones help!!&lt;br&gt;
&lt;br&gt;
Hassan</description>
    </item>
    <item>
      <pubDate>Thu, 15 Oct 2009 19:16:03 -0400</pubDate>
      <title>Re: Testing if vector x is twice vector y</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263245#687366</link>
      <author>Justin </author>
      <description>&quot;El Hassan Abdel Fattah&quot; &amp;lt;s8ru9@unb.ca&amp;gt; wrote in message &amp;lt;hb7r2f$8p4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; hello all,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; im a university student and currently im taking a matlab course this term. i got an assignment due tomorrow and needed some help:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if we have two variables:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; x = [4; 1; 4; 6; 2]&lt;br&gt;
&amp;gt; y = [3; 9; 2; 3; 1]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; question is as follows: Test if all the elements of x are twice as big as the corresponding elements in y OR any element of x is less than the corresponding element of y.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; given hint: use the functions 'all( )' and 'any( )' and logic operators ('|', single vertical bar) for vectors.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for anyones help!!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hassan&lt;br&gt;
&lt;br&gt;
This can be done in two or 3 commands, but since it's a HW assignment I can't give you an answer and feel honorable.  I will give you some hints and you will have to do some reading and thinking.&lt;br&gt;
&lt;br&gt;
you might want to use the help command to look up:&lt;br&gt;
1.) the &quot;mod&quot; command&lt;br&gt;
2.) &quot;.&quot; based commands (specifically what ./ does)&lt;br&gt;
&lt;br&gt;
Good luck.&lt;br&gt;
&lt;br&gt;
--Justin</description>
    </item>
    <item>
      <pubDate>Thu, 15 Oct 2009 19:17:22 -0400</pubDate>
      <title>Re: Testing if vector x is twice vector y</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263245#687367</link>
      <author>us</author>
      <description>&quot;El Hassan Abdel Fattah&quot; &amp;lt;s8ru9@unb.ca&amp;gt; wrote in message &amp;lt;hb7r2f$8p4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; hello all,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; im a university student and currently im taking a matlab course this term. i got an assignment due tomorrow and needed some help:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if we have two variables:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; x = [4; 1; 4; 6; 2]&lt;br&gt;
&amp;gt; y = [3; 9; 2; 3; 1]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; question is as follows: Test if all the elements of x are twice as big as the corresponding elements in y OR any element of x is less than the corresponding element of y.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; given hint: use the functions 'all( )' and 'any( )' and logic operators ('|', single vertical bar) for vectors.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for anyones help!!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hassan&lt;br&gt;
&lt;br&gt;
a hint:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;help all;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;help any;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;help or;&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Thu, 15 Oct 2009 19:46:18 -0400</pubDate>
      <title>Re: Testing if vector x is twice vector y</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263245#687372</link>
      <author>El Hassan Abdel Fattah</author>
      <description>&quot;Justin &quot; &amp;lt;justink@email.unc.edu&amp;gt; wrote in message &amp;lt;hb7sdj$8a7$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;El Hassan Abdel Fattah&quot; &amp;lt;s8ru9@unb.ca&amp;gt; wrote in message &amp;lt;hb7r2f$8p4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; hello all,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; im a university student and currently im taking a matlab course this term. i got an assignment due tomorrow and needed some help:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; if we have two variables:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; x = [4; 1; 4; 6; 2]&lt;br&gt;
&amp;gt; &amp;gt; y = [3; 9; 2; 3; 1]&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; question is as follows: Test if all the elements of x are twice as big as the corresponding elements in y OR any element of x is less than the corresponding element of y.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; given hint: use the functions 'all( )' and 'any( )' and logic operators ('|', single vertical bar) for vectors.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks for anyones help!!&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Hassan&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This can be done in two or 3 commands, but since it's a HW assignment I can't give you an answer and feel honorable.  I will give you some hints and you will have to do some reading and thinking.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; you might want to use the help command to look up:&lt;br&gt;
&amp;gt; 1.) the &quot;mod&quot; command&lt;br&gt;
&amp;gt; 2.) &quot;.&quot; based commands (specifically what ./ does)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Good luck.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --Justin&lt;br&gt;
&lt;br&gt;
Thanks for your help. The command i'm writing goes like this: &quot;x=all(y.*2)&quot;. I'm basically trying to get matlab to display all elements in x are twice y. my answer comes to be 1, which implies a true statement, however it is false. i know it is very simple but im not getting there for some reason. thanks again</description>
    </item>
    <item>
      <pubDate>Thu, 15 Oct 2009 20:34:28 -0400</pubDate>
      <title>Re: Testing if vector x is twice vector y</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263245#687385</link>
      <author>dpb</author>
      <description>El Hassan Abdel Fattah wrote:&lt;br&gt;
&amp;gt; &quot;Justin &quot; &amp;lt;justink@email.unc.edu&amp;gt; wrote in message &amp;lt;hb7sdj$8a7$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; &quot;El Hassan Abdel Fattah&quot; &amp;lt;s8ru9@unb.ca&amp;gt; wrote in message &amp;lt;hb7r2f$8p4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; hello all,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; im a university student and currently im taking a matlab course this term. i got an assignment due tomorrow and needed some help:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; if we have two variables:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; x = [4; 1; 4; 6; 2]&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; y = [3; 9; 2; 3; 1]&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; question is as follows: Test if all the elements of x are twice&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; as  big as the corresponding elements in y OR any element of x is less than&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; the corresponding element of y.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; given hint: use the functions 'all( )' and 'any( )' and logic&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; operators ('|', single vertical bar) for vectors.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Thanks for anyones help!!&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Hassan&lt;br&gt;
&amp;gt;&amp;gt; This can be done in two or 3 commands, but since it's a HW&lt;br&gt;
&amp;gt;&amp;gt; assignment I can't give you an answer and feel honorable. I will give you some&lt;br&gt;
&amp;gt;&amp;gt; hints and you will have to do some reading and thinking.&lt;br&gt;
&amp;gt;&amp;gt; you might want to use the help command to look up:&lt;br&gt;
&amp;gt;&amp;gt; 1.) the &quot;mod&quot; command&lt;br&gt;
&amp;gt;&amp;gt; 2.) &quot;.&quot; based commands (specifically what ./ does)&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
...&lt;br&gt;
&amp;gt; Thanks for your help. The command i'm writing goes like this:&lt;br&gt;
&amp;gt; &quot;x=all(y.*2)&quot;. I'm basically trying to get matlab to display all&lt;br&gt;
&amp;gt; elements in x are twice y. my answer comes to be 1, which implies a&lt;br&gt;
&amp;gt; true statement, however it is false. i know it is very simple but im&lt;br&gt;
&amp;gt; not getting there for some reason. thanks again&lt;br&gt;
&lt;br&gt;
Well, first stop and figure out how you would solve the problem by hand. &lt;br&gt;
&amp;nbsp;&amp;nbsp;I don't think the above expression would fit into that if you think it &lt;br&gt;
thru that way.  IOW, what do you instinctively do in determining whether &lt;br&gt;
your answer is right for the first part, then the second?&lt;br&gt;
&lt;br&gt;
I'll make the hint that I don't see mod() coming into play here, at &lt;br&gt;
least the way I'd approach it but agree w/ &quot;./&quot; ... :)&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Thu, 15 Oct 2009 21:12:40 -0400</pubDate>
      <title>Re: Testing if vector x is twice vector y</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263245#687391</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &lt;br&gt;
news:hb7sg2$d7i$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &quot;El Hassan Abdel Fattah&quot; &amp;lt;s8ru9@unb.ca&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;hb7r2f$8p4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; hello all,&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; im a university student and currently im taking a matlab course this &lt;br&gt;
&amp;gt;&amp;gt; term. i got an assignment due tomorrow and needed some help:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; if we have two variables:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; x = [4; 1; 4; 6; 2]&lt;br&gt;
&amp;gt;&amp;gt; y = [3; 9; 2; 3; 1]&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; question is as follows: Test if all the elements of x are twice as big as &lt;br&gt;
&amp;gt;&amp;gt; the corresponding elements in y OR any element of x is less than the &lt;br&gt;
&amp;gt;&amp;gt; corresponding element of y.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; given hint: use the functions 'all( )' and 'any( )' and logic operators &lt;br&gt;
&amp;gt;&amp;gt; ('|', single vertical bar) for vectors.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Thanks for anyones help!!&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Hassan&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; a hint:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;     help all;&lt;br&gt;
&amp;gt;     help any;&lt;br&gt;
&amp;gt;     help or;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; us&lt;br&gt;
&lt;br&gt;
Adding on to us's hint:&lt;br&gt;
&lt;br&gt;
help lt&lt;br&gt;
help gt&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com&lt;br&gt;
comp.soft-sys.matlab (CSSM) FAQ: &lt;a href=&quot;http://matlabwiki.mathworks.com/MATLAB_FAQ&quot;&gt;http://matlabwiki.mathworks.com/MATLAB_FAQ&lt;/a&gt; </description>
    </item>
  </channel>
</rss>

