Answered step by step
Verified Expert Solution
Question
1 Approved Answer
First, use Matlab to create another folder inside your homework folder called lastname-initial-pp05 where lastname is YOUR last name and initial is YOUR first initial.
First, use Matlab to create another folder inside your homework folder called lastname-initial-pp05 where lastname is YOUR last name and initial is YOUR first initial. Use all lower-case letters when naming your folder for this assignment. Second, download the grading script for this problem and save it to the folder you just created. Make sure you save all the m-files for this assignment to this folder as well. When you have finished the assignment, run the grading script and then use Matlab to create a .zip file of your assignment folder. Submit only this .zip file to the D2L dropbox. Write a Matlab function called backthatstringup.m which takes any string (i.e. vector of char's... a list of characters, surrounded by single quotes) and rewrites it in reverse order. You must use either a for loop or a while loop in your code and you may not use the built-in Matlab functions fliplr or flipud. The specifications for the function and some sample function calls are shown below. input parameter message a string to be reversed output parameter egassem the reversed message sample function calls backthatstringup ('This is a sentence.') produces '_ecnetnes a si sihT' backthatstringup ('12345') produces '54321' backthatstringup('racecar') produces 'racecar' Write a Matlab function called swapcode.m that takes a string txt as input and returns an-other string swaptxt as output. The function encodes the string by reversing the alphabet: it replaces each 'a' with 'z', each 'b' with 'y', each 'c' with 'x', etc. The function must work for uppercase letters the same way, but it must not change any other characters. Note that if you call the function twice like this txtout = flipcode (flipcode (txtin)) then the string stored in txtout will be identical to the string stored in txtin. The specifications for the function and some sample function calls are shown below. input parameter txt a string output parameter swaptxt a string sample function calls swapcode ('This is a sentence.') produces 'Gsrh rh z hvmgvmxv.' swapcode ('Who has a 3-legged dog?') produces 'Dsl szh z 3-ovttvw wlt?' swapcode (swapcode('Dave97')) produce 'Dave97
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