Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SOLVE WITHOUT USING CONDITIONS OR LOOPS Function Name: coldwar Inputs: 1. 2. 3. (char) a scrambled character vector (double) an integer representing the shift of
SOLVE WITHOUT USING CONDITIONS OR LOOPS
Function Name: coldwar Inputs: 1. 2. 3. (char) a scrambled character vector (double) an integer representing the shift of odd indices (double) an integer representing the shift of even indices Outputs: 1. (char) the unscrambled character vector Background: While enjoying the winter weather with some pals, you decide to have a snowball fight. Your teammate, on the other side of Tech Green, wants to communicate a frosty message to you without the opposing side being able to decode it. They decide to shout a scrambled version of your message along with two numbers that represent shift values. Since your and your friend are well versed in MATLAB, you decide to write a quick function to decode the encrypted message. Function Description: You must 'shift the letters at even indices by a certain amount and the letters at odd indices by a different amount. For example, if the letter is 'a' and the shift amount is 4 the letter will then become 'e'. A negative shift means shifting towards 'a' in the alphabet. The shift should 'wrap' around the alphabet- 'x' shifted by 7 should become 'e' Example: [out] = coldar("usph',2,-4) out = 'word' Notes: There will be no spaces or uppercase letters. The shift may be greater than 26. A positive shift of 28 is the same as a shift of 2. Hints: mod() will be useful
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