Question

In: Mechanical Engineering

Suppose that x = [10, -2, 6, 5, -3] and y = [9, -3, 2, 5, -1]. Find the results of the following operations by hand and use MATLAB to check your results.

Suppose that x = [10, -2, 6, 5, -3] and y = [9, -3, 2, 5, -1]. Find the results of the following operations by hand and use MATLAB to check your results.

a. z = (x < 6)

b. z = (x <= y)

c. z = (x == y)

d. z = (x ~= y)

Solutions

Expert Solution

(a)

z = (x<6)
z = 0 1 0 1 1


(b)

z = (x<=y)
z = 0 0 0 1 1


(c)

z = (x==y)
z = 0 0 0 1 0


(d)

z = (x ~ =y)
z = 1 1 1 0 1

 

MATLAB CODE:


%Code start

clear all

x = [10 -2 6 5 -3];
y = [9 -3 2 5 -1];

z = x < 6
z = x <= y
z = x == y
z = x ~= y

%Code end

 

Code run result:

z = 0 1 0 1 1


z = 0 0 0 1 1


z = 0 0 0 1 0


z = 1 1 1 0 1

 

The results from hand and result from MATLAB are matching.


a)

z = (x<6)
z = 0 1 0 1 1


(b)

z = (x<=y)
z = 0 0 0 1 1

Related Solutions

Consider the following data: X Y 1 13 3 10 5 9 5 5 6 3...
Consider the following data: X Y 1 13 3 10 5 9 5 5 6 3 Draw a Scatter Plot of the data. Do you believe the correlation coefficient r will be positive, negative or close to zero? Why What is your estimate to the value of Y associated with X=4?
x 2 8 5 9 4 3 9 6 7 8 y 3 6 5 7...
x 2 8 5 9 4 3 9 6 7 8 y 3 6 5 7 9 7 4 6 9 9 -5.48x + 0.17 5.48x + 0.17 -0.17x + 5.48 0.17x + 5.48
Suppose f(x,y)=(1/8)(6-x-y) for 0<x<2 and 2<y<4. a. Find p(Y<3|X=1) b. Find p(Y<3|0.5<X<1)
Suppose f(x,y)=(1/8)(6-x-y) for 0<x<2 and 2<y<4. a. Find p(Y<3|X=1) b. Find p(Y<3|0.5<X<1)
Find equations of the following. 2(x − 9)2 + (y − 6)2 + (z − 1)2...
Find equations of the following. 2(x − 9)2 + (y − 6)2 + (z − 1)2 = 10,    (10, 8, 3) (a) the tangent plane (b) the normal line (x(t), y(t), z(t))=
For each problem, find the valuesc that satisfy Rolle's Theorem 5. y=x^2+4x+5 [-3,-1] 6. y=x^3-2x^2-x-1 [-1,2]...
For each problem, find the valuesc that satisfy Rolle's Theorem 5. y=x^2+4x+5 [-3,-1] 6. y=x^3-2x^2-x-1 [-1,2] 7. -x^3+2x^2+x-6 [-1,2] 8. x^3-4x-x+7 [-1,4]
Find the maximum of f(x,y)=9-x^2-y^2 subject to x+y=3
Find the maximum of f(x,y)=9-x^2-y^2 subject to x+y=3
use a matlab built-in function to numerically solve: dy/dx= -x^2+((x^3*e^-y)/4) for 1<=x<=5 with y(1)=1 plot the...
use a matlab built-in function to numerically solve: dy/dx= -x^2+((x^3*e^-y)/4) for 1<=x<=5 with y(1)=1 plot the solution
ID X Y 1 2 3 2 3 6 3 4 6 4 5 7 5...
ID X Y 1 2 3 2 3 6 3 4 6 4 5 7 5 8 7 6 5 7 7 6 7 8 8 8 9 7 8 10 12 11 Test the significance of the correlation coefficient. Then use math test scores (X) to predict physics test scores (Y).  Do the following: Create a scatterplot of X and Y. Write the regression equation and interpret the regression coefficients (i.e., intercept and slope). Predict the physics score for each....
Using matlab Find x and y that solve the following system: ln(x 2 + y) =...
Using matlab Find x and y that solve the following system: ln(x 2 + y) = 1 − y , xy = − √ x
2. Consider the following data: x= 1, 2, 3, 4, 5 y =3, 2, 4, 6,...
2. Consider the following data: x= 1, 2, 3, 4, 5 y =3, 2, 4, 6, 5 By hand, not using Matlab, and showing your work: (a) Compute the correlation coefficient. (b) Find the least-squares line. (c) Find the standard deviation around the least-squares line.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT