Question

In: Computer Science

For the arrays x and y given below, use MATLAB to find all the elements in x that are greater than the corresponding elements in y.

For the arrays x and y given below, use MATLAB to find all the elements in x that are greater than the corresponding elements in y.

x = [-3, 0, 0, 2, 6, 8] y = [-5, -2, 0, 3, 4, 10]

Solutions

Expert Solution

Using MATLAB method:

 

% declaring 2 arrays given

x = [-3, 0, 0, 2, 6, 8];

y = [-5,-2, 0, 3, 4, 10];

% looping through each element in x

% comparing with corresponding element in y

% printing if it is greater

for i=1:length(x)

if x(i)>y(i)

fprintf("%d ",x(i))

end

end

Sample Output

-3 0 6

 


Sample Output

-3 0 6

Related Solutions

Calculate the Y values corresponding to the X values given below.  Find the critical values for X...
Calculate the Y values corresponding to the X values given below.  Find the critical values for X for the given polynomial by finding the X values among those given where the first derivative, dy/dx = 0 and/or X values where the second derivative, d­2y/dx2 = 0.    Be sure to find the sign (+ or -) of  dy/dx and of d2y/dx2 at all X values. Reference Lesson 13 and the text Appendix A (pp 694 – 698), as needed.  Using the first and second derivative...
Calculate the Y values corresponding to the X values given below. Find the critical values for...
Calculate the Y values corresponding to the X values given below. Find the critical values for X for the given polynomial by finding the X values among those given where the first derivative, dy/dx = 0 and/or X values where the second derivative, d¬2y/dx2 = 0. Be sure to indicate the sign (+ or -) of dy/dx and of d2y/dx2 tabled values. Using the first and second derivative tests with the information you have calculated, determine which X value(s) represent...
Calculate the Y values corresponding to the X values given below. Find the critical values for...
Calculate the Y values corresponding to the X values given below. Find the critical values for X for the given polynomial by finding the X values among those given where the first derivative, dy/dx = 0 and/or X values where the second derivative, d­2y/dx2 = 0.    Be sure to find the sign (+ or -) of dy/dx and of d2y/dx2 at all X values. Reference Lesson 13 and the text Appendix A (pp 694 – 698), as needed. Using the...
Calculate the Y values corresponding to the X values given below. Find the critical values for...
Calculate the Y values corresponding to the X values given below. Find the critical values for X for the given polynomial by finding the X values among those given where the first derivative, dy/dx = 0 and/or X values where the second derivative, d­2y/dx2 = 0. Be sure to indicate the sign (+ or -) of dy/dx and of d2y/dx2 tabled values. Reference Power Point Lesson 13 as needed. Using the first and second derivative tests with the information you...
Calculate the Y values corresponding to the X values given below. Find the critical values for...
Calculate the Y values corresponding to the X values given below. Find the critical values for X for the given polynomial by finding the X values among those given where the first derivative, dy/dx = 0 and/or X values where the second derivative, d­2y/dx2 = 0. Be sure to indicate the sign (+ or -) of dy/dx and of d2y/dx2 tabled values. Reference Power Point Lesson 13 as needed. Using the first and second derivative tests with the information you...
Given ? = ???+??? + ??? and ? = ???-3?? + ????. Use MATLAB to find...
Given ? = ???+??? + ??? and ? = ???-3?? + ????. Use MATLAB to find the following: a) ? + ? b) ?  ? c) ? × ? d) A unit vector in the direction of ? − 2? e) ??? f) The component of ? along ? 2. Use MATLAB to convert points ?(11,4,15), ?(10,−14,33) and ?(−33,−14,15) from Cartesian to Cylindrical and Spherical coordinates.
For the following u(x, y), show that it is harmonic and then find a corresponding v(x,...
For the following u(x, y), show that it is harmonic and then find a corresponding v(x, y) such that f(z)=u+iv is analytic. u(x, y)=(x^2-y^2) cos(y)e^x-2xysin(y)ex
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
The 2 -dimensional arrays m1 and m2 are strictly identical if their corresponding elements are equal.  ...
The 2 -dimensional arrays m1 and m2 are strictly identical if their corresponding elements are equal.   Write the method "equals" which returns True if the arrays are strictly identical and False if they are not. The method's header is: public static boolean equals(int[][] m1, int[][] m2) Here is the program: import java.util.Scanner; public class StrictlyEquals { public static void main(String[] args) { Scanner input = new Scanner(System.in); final int ROW_SIZE = 3; final int COLUMN_SIZE = 3; System.out.print("Enter m1 (a...
Given the plot of y=f(x) below, find the plot of y=f−1(x). A coordinate plane has a...
Given the plot of y=f(x) below, find the plot of y=f−1(x). A coordinate plane has a horizontal x-axis labeled from negative 7 to 7 in increments of 1 and a vertical y-axis labeled from negative 7 to 7 in increments of 1. A curve starts at the point left-parenthesis negative 1 comma 0 right-parenthesis, rises at an increasing rate from left to right and passes through left-parenthesis 1 comma 1 right-parenthesis and left-parenthesis 4 comma 6 right-parenthesis. Select the correct...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT