Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1b. Problem definition For this question start by saving q1a.m into q1b.m. Modify the code in your script so that you create another vector
Question 1b. Problem definition For this question start by saving q1a.m into q1b.m. Modify the code in your script so that you create another vector C that contains 2 raised to the power of each element of A. Note, that you can raise 2 to any value in MATLAB by using the pow2 function. So, for example, pow2(3) will produce the value 8. Again, your program should work for any values of A in the range - 100 to 100 not just the current values of A. Testing For this question you should, in a text file called q1b.txt, write a table containing three new test cases. As a reference example, two possible test cases for this are: A [1 2 4] [2 4 16] [-1 0 1] [0.5 1 2] Coding Now code your solution to the problem above in your q1b.m file. Make sure you include some code at the end to display the vector C. In your coding, consider whether you can use the same for-loop to produce the vector C or whether you have to use a second for-loop
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