Question: MATLAB 1. Create a new script that is called HW12a.m and save it. Define X, a random vector of size (20,1) Define a separate for

 MATLAB 1. Create a new script that is called HW12a.m and

MATLAB

1. Create a new script that is called HW12a.m and save it. Define X, a random vector of size (20,1) Define a separate for loop for the following problems a) Using single for loop, add all elements of X and assign the sum to a new variable Y1 b) Using single for loop, add all odd elements of X and assign the sum to a new variable Y2. c) Using single for loop, multiply all elements of X and assign the product to a new variable Y3. d) Using single for loop, multiply aeements of X and assign the product to a new variable e) f) g) Y-Al Using single for loop, find all elements of X that are multiples of 3 and assign those elements to a new column vector YS Using single for loop, find all elements of X that are multiples of 2 or 3 and assign those elements to a new column vector Y6 Using single for loop, find all elements of X that are multiples of 2 and 3 and assign those elements to a new column vector Y6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!