Answered step by step
Verified Expert Solution
Question
1 Approved Answer
matlab code please Trace the following code to answer the questions below. Do NOT harded Your significant other knows how much you love MATLAB and
matlab code please
Trace the following code to answer the questions below. Do NOT harded Your significant other knows how much you love MATLAB and decided to use MATLAB to encode a message for Valentine's Day. The inputs to the below function are 1x double vectors of equal, even length. Fill in the blanks labeled (ah-(e) based on the comments provided You are not restricted to the one line - you may write as many lines as you may need. (25 points) 1 function finalGift - valentinescramble gitti, gift2) 2 len - Length (gifti); Create a vector of ones twice the length of gift called gift3). 4 gift3 - (a) 5 gift3(1:2:end) gifti: 6 Insert gift2 into every other index of gitt3, starting from the end of gift3 (The first index of gift2 should be inserted into the last index of gift3). 7 (b) 8 gift4 - Igitti gift2); 9 Sort gifts in descending order. 2len - lengthoitti I create vector of ones turon the length of site easies gire- 5 gift3r12:end) - gittis Insert gift 2 into every other index of it, starting from the end of gift3 The first index of gift should be inserted into the last index of gifts). 7 (b) 8 gitt Igifti gift2): 9 Sort gift 3 in descending order. 10 gift3 (c) 11 Multiply the odd indices of gift3 by 3. 12 13. Delete the first and last indices of gift4. 14 15 finalGift - Igift4 length (gift4) gift3); 16 end 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