Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WSU EE221 Numerical Computing for Engineers Fall 2018 HW #14 Create a new script that is called HW14.m and save it. Define X as following

WSU EE221

Numerical Computing for Engineers

Fall 2018 HW #14

Create a new script that is called HW14.m and save it.

Define X as following (note that X is a 100x1 vector): X = randi(100,100,1); image text in transcribed

WSu EE221 Numerical Computing for Engineers Fall 2018 HW #14 Create a new script that is called HW14.m and save it. Define X as following (note that X is a 100x1 vector): x randi (100,100,1); Define a separate while loop for the following problems. a) Using single while loop, add alelements of X and assign the sum to a new variable Y1. b) Using single while loop, add al elements of X that are odd and assign the sum to a new variable Y2. Hint: Use mod command to check if an element is odd i.e. mod(X(i),2) is odd) Using single while loop, multiply all elements of X and assign the product to a new variable Y3. Using single while loop, multiply all elements of X that are even and assign the product to a new variable Y4. Hint: Use mod command to check if an element is even i.e. mod(),20 (this is true of X(i) is even) 0 (this is true of X() c) d) e) Using single while loop, find all elements of X that are multiples of 3 and assign those elements f Using single while loop, find all elements of X that are multiples of 2 or 3 and assign those g) Using single while loop, find all elements of X that are multiples of 2 and 3 and assign those to a new column vector Y5. elements to a new column vector Y6. elements to a new column vector Y6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

Students also viewed these Databases questions