Question
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
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. %task8Vector = [ 3 4 5 ] %task8Vector(10)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started