Answered step by step
Verified Expert Solution
Question
1 Approved Answer
IN MATLAB 1. Create a vector called V, which consists of all integers from -3 to 5. 2. Use the MATLAB function mod on the
IN MATLAB
1. Create a vector called V, which consists of all integers from -3 to 5. 2. Use the MATLAB function mod on the vector V to determine which integer is even. Call the result new. For example, mod(-2,2) = 0 where 0 is the remainder of dividing -2 by 2. Hence, -2 is an even number. 3. Pick up the even integers by doing the following: E = V(new == 0). new == 0 will give you True/False results in 1's and O's. O means that particular integer is even. Hence, V(new == 0) will give you all the even numbers from the array. 4. Create a vector called B, which consists of all integers from -3 to 5. 5. Use the MATLAB function mod on the vector b to determine which integer is odd. Call the result b. For example, mod(-3,2) = 1 where 1 is the remainder of diving -3 by 2. Hence, -3 is an odd number. 6. Pick up the odd integers by doing the following: 0 = B(b == 1). new == 1 will give you True/False results in 1's and O's. 1 means that particular integer is odd. Hence, O = B(b == 1) will give you all the odd numbers from the array. 1. Create a vector called V, which consists of all integers from -3 to 5. 2. Use the MATLAB function mod on the vector V to determine which integer is even. Call the result new. For example, mod(-2,2) = 0 where 0 is the remainder of dividing -2 by 2. Hence, -2 is an even number. 3. Pick up the even integers by doing the following: E = V(new == 0). new == 0 will give you True/False results in 1's and O's. O means that particular integer is even. Hence, V(new == 0) will give you all the even numbers from the array. 4. Create a vector called B, which consists of all integers from -3 to 5. 5. Use the MATLAB function mod on the vector b to determine which integer is odd. Call the result b. For example, mod(-3,2) = 1 where 1 is the remainder of diving -3 by 2. Hence, -3 is an odd number. 6. Pick up the odd integers by doing the following: 0 = B(b == 1). new == 1 will give you True/False results in 1's and O's. 1 means that particular integer is odd. Hence, O = B(b == 1) will give you all the odd numbers from the arrayStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started