Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WANT 6 , 7 AND 9 . PLEASE ANSWER THOSE. 6 , 7 AND 9 . USE MATLAB, ANSWER # 6 , # 7 AND

WANT 6,7 AND 9. PLEASE ANSWER THOSE. 6,7 AND 9.USE MATLAB, ANSWER #6, #7 AND #9; OTHER QUESTIONS ARE THERE FOR CONTEXT)Task #1: Generate a column-vector with 15 random values between 0 and 1 using the rand function. Name this randCol.Task #2: Generate a row-vector with 20 random whole numbers between 1 and 50 using the randi function. Name this randRow. Task #3: Delete the last 10 elements of the vector randRow using the vector-indexing and the end keyword.Task #4: Using the linspace function, create a vector of 30 evenly spaced values ranging from -4*pi to 4*pi. Name this vector piRange.\Task #5: Update the vector piRange to swap the first and last elements.Task #6: Save the values at indexes 2,4,1,7 and 8 in that order, from the vector piRange above to a new vector called outOfOrder. Use vector-indexing to access those values.Task #7: Using the linspace function, generate a vector named linspace7 with the same values that result from this colon notation expression (2 : 0.5 : 10)Task #8: Uncomment the code that you see below. Try running the script again to see the error that occurs. You see this error because the second line of code is attempting to access the value at index ten of the vector task8Vector. This vector only has 3 elements, therefore index ten is out of bounds and causes an error. Update the code below to instead extend this vector by setting the value at index ten to 8.5. We talked about using an out-of-bounds element assignment to extend a vector in class.Task #9: Using linspace, create the following row vectors, and save them to any variable name you choose. [-8-6-4-20][468][97.56]Task #10: See the vector below called inventory. This vector represents both the price and quantity sold of items from a clothing store. The odd indexes, (1,3,5,...) represent the quantity sold of a given item - and the value immediatlely to the right is the corresponding price. Create a vector called revenue which will store the sales revenue of each item (quantity sold * price.) Do not manually copy & paste values - instead use vector indexing and element-wise multiplication, .*, to solve this problem. For reference, revenue should have 6 values, and the first value should be 12(quantity)*23.25(price)==>279Task #11: Find the sum of the first 100 elements in the harmonic series: 1+1/2+1/3+1/4+....+1/100 You can use vector element-wise division in a couple of different ways to generate a vector that houses the above series of numbers. You can then use the sum function to add all 100 elements of that vector together. Save this sum to a new variable called sumHS.

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 Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions