Path: news.mathworks.com!not-for-mail
From: "El Hassan Abdel Fattah" <s8ru9@unb.ca>
Newsgroups: comp.soft-sys.matlab
Subject: Testing if vector x is twice vector y
Date: Thu, 15 Oct 2009 18:53:03 +0000 (UTC)
Organization: University of New Brunswick
Lines: 16
Message-ID: <hb7r2f$8p4$1@fred.mathworks.com>
Reply-To: "El Hassan Abdel Fattah" <s8ru9@unb.ca>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1255632783 8996 172.30.248.35 (15 Oct 2009 18:53:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 15 Oct 2009 18:53:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2042725
Xref: news.mathworks.com comp.soft-sys.matlab:577641


hello all,

im a university student and currently im taking a matlab course this term. i got an assignment due tomorrow and needed some help:

if we have two variables:

x = [4; 1; 4; 6; 2]
y = [3; 9; 2; 3; 1]

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.

given hint: use the functions 'all( )' and 'any( )' and logic operators ('|', single vertical bar) for vectors.

Thanks for anyones help!!

Hassan