Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please help me out with this MatLab problem? PLease make sure that the output in MatLab matches the output on the example given

Can someone please help me out with this MatLab problem? PLease make sure that the output in MatLab matches the output on the example given in the problem. Thanks!image text in transcribed

PROBLEM 1: Analyzing an Array (30 points) Write a program that performs the following steps. Unless otherwise specified, suppress output to the Command Window (a) Create a variable named Vand assign to it a 250-element row vector whose elements are each randomly generated real numbers chosen uniformly from the open interval (-4.5, 5.5) (b) Create variables numNegative, numPositive, sumPositive, meanPositive, and prodRange. Initialize each variable to an appropriate scalar value. numNegative, numPositive: number of negative and positive elements in V respectively sumPositive, meanPositive: sum of all the positive elements in V respectively prodRange: the product of all real numbers in vector Vin the range [2.3, 2.6] (c) Declare a for-end statement using a loop variable named k that will be assigned to every element of a row vector whose elements represent the indices/positions of row vector V (d) The body of the for-end statement should update, when applicable, the values of numNegative, numPositive, sumPositive, and prodRange. The use of built in functions sum, mean, and prod is NOT allowed. (e) After the for-end statement, compute the mean of the positive real numbers in vector Vand assign the mean to a variable named meanPositive. (f) Using multiple instances of fprintf, display the values contained in variables numNegative, numPositive, sumPositive, meanPositive, and prodRange, respectively Format variables numNegative and numPositive as integers. Format variables sumPositive, meanPositive and prodRange as fixed-point real numbers, each showing a maximum of 3 digits after the decimal point The result of executing your program should look similar to the sample output shown below FIRSTNAME LASTNAME LAB 6 probleml Vector V has 119 negative elements Vector V has 131 positive elements The sum of vector V's positive elements is 363.659 The mean of vector V's positive elements is 2.776 The product of the elements in the range [2. 3, 2.6 is 229.376

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

=+2. Explain the manufacturing model of radio management!

Answered: 1 week ago

Question

How can Aqualisa segment the consumers in the market in the case

Answered: 1 week ago