Question: Task #9: Using linspace, create the following row vectors, and save them to any variable name you choose. [ -8 -6 -4 -2 0 ]
Task #9: Using linspace, create the following row vectors, and save them to any variable name you choose. [ -8 -6 -4 -2 0 ] [ 4 6 8 ] [ 9 7.5 6 ]
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) ==> 279 % Add code for task here
inventory = [ 12 23.25 3 7.99 80 2.50 4 79.40 2 109.99 30 24.50 ]
Task #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
Get step-by-step solutions from verified subject matter experts
