E7_Lab05_Solutions_Fall_2010

E7_Lab05_Solutions_Fall_2010 - Contents problem 1 Problem 2...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Contents problem 1 Problem 2 Problem 3 problem 4 Problem 5 problem 6 problem 7 problem 8 problem 9 %Lab 05 Solutions problem 1 %1 a clear x = 10; y = -58; a = x<y %a is false (0) because x is not less than y b = x>=y %b is true (1) because x is greater than y c = x==y %c is false (0) because x is not equal to y d = (x - 68) >= y %d is true (1) because (x - 68) is equal to y e = x - 68 >= y %e is also true becuase math operations are carried out %before relational operations f = x - (68 >= y) %f is 9 because 10 minus 1 (true) equals 9 x=y; h = x~=y %h is false because x is equal to y i.e. x isn't not equal to y ii = ~x~=y %%ii is true because it is the opposite of h %j is true because 1 and 1 are both true k = 1|1 %k is true because 1 or 1 is true %l is false because 1 and 0 are not both true m = 1|0 %m is true because 1 OR 0 is true %n is true becasue doubles are considered to be true o = isnumeric(m) %o is false because m is logical, not numeric p = isnumeric( 'g' ) %p is false because 'g' is a character, not numeric q=isnumeric(6) %q is true because 6 is numeric r=isscalar([2 7]) %r is false because [2 7] is a vector, not scalar s=islogical(m) %s is true because m is a logical t=5 - m %t is 4 because a logical is converted to a value (1) when operated on u=class(t) %u is 'double' because t is a double (i.e. operating with logicals %returns a numeric result %1 b clear x = 10; y = -58; %58 - 10 is greater than 0 (true), y is less than x % (~true = false) true and false gives false. b = (x+y)/2+24==1 | x~=5+9
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 01/21/2011.

Page1 / 11

E7_Lab05_Solutions_Fall_2010 - Contents problem 1 Problem 2...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online