Question: I need last 4 and how to write it.. Given a 'circular' row array A and an interger value n, shift A by n positions

I need last 4 and how to write it..  I need last 4 and how to write it.. Given a
'circular' row array A and an interger value n, shift A by
n positions to the right. This is similar to shift array problems

Given a 'circular' row array A and an interger value n, shift A by n positions to the right. This is similar to shift array problems on zyBook (we've seen two) with three twists: 1. We are shifting the array to the right instead of left. 2. We are shifting the array by a variable number of positions. 3. The array is circular so the left-most elements are no longer lost. Instead, they are Consider the 1x9 row array [1, 2, 3, 4, 5, 6, 7, 8, 9]. For various values of n, the expected ou . n = 1: [9, 1, 2, 3, 4, 5, 6, 7, 8] . n = 2:[8, 9, 1, 2, 3, 4, 5, 6, 7] . n = 3: [7, 8, 9, 1,2,3,4,5,6) n = 8: [2, 3, 4, 5, 6, 7, 8, 9, 1] . n = 9:[1, 2, 3, 4, 5, 6, 7, 8, 9] n = 10:19. 1. h 3, 4, 5, 6, 7, 8] Notice that when n is equal to or larger than the length of the array, the result is the same as Task Write a function circularShiftRight that takes two inputs (atray and shift value, in this order) a 3 4 1 % Modify the function header below 2 function y = circularShiftRight(inputtArr,n) % YOUR CODE STARTS N= lenght (inputArr); % YOUR CODE ENDS [inputArr inputArr); 7 for i=1:N y(i)=x(i+j); 5 6 7 X = 8 9 10 end Check whether circshift is used Check the function definition Check if circularShiftRight correctly shifts 1x9 array by 1 position. * Check if citcularShiftRight correctly shifts variable-sized array by 1 position. Check if circularShiftRight correctly shifts 1x9 array by a variable number of position. Check if circularShiftRight correctly shifts variable-sized array by a variable number of position

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!