Question: This is for MATLAB class there are some txt files given, since I can't upload those here, if you write your mail address on the
This is for MATLAB class
there are some txt files given, since I can't upload those here, if you write your mail address on the comment, i can send them( if you need those)
please write the MATLAB code
Thanks in advance
These are the answers with the test cases.
Function Name: shakespeare
%
% Test Cases:
% [rhyme1] = shakespeare('roses.txt')
% rhyme1 => ABAC
%
% [rhyme2] = shakespeare('limerick.txt')
% rhyme2 => AABBA
%
% [rhyme3] = shakespeare('sonnet.txt')
% rhyme3 => ABABCDCDEFEFGG
%


Function Name: shakespeare Inputs 1. (char) The filename of a poem Outputs 1. (char) The string of the rhyme scheme Background: After finding out whether a short poem rhymes or not in a Dr. Seuss book, you want to flex your MATLAB muscle to help you out on your harder English work. You are taking your skills to Shakespeare to find the rhyme scheme of a poem Function Description: Write a function in MATLAB that finds the rhyme scheme of a poem. The first input is a string and is the name of a file to read. The file will be some number of lines, and using the rhyming rules from the first problem (the last two letters of last word must match), you must find the rhyme scheme of the poem in the file. The rhyme scheme will be denoted as a string of capital letters, starting with 'A', where lines that rhyme have the same letter. That is, every line that rhymes with the first line will be an A, every line that rhymes with the next line (that doesn't rhyme with the first) is a 'B, and so on. There will not be more than 26 unique line endings (you will never need more than 'Z') Example: If the poem in the file is as follows Roses are red, Violets are blue This problem has led, Me straight to you! Function Name: shakespeare Inputs 1. (char) The filename of a poem Outputs 1. (char) The string of the rhyme scheme Background: After finding out whether a short poem rhymes or not in a Dr. Seuss book, you want to flex your MATLAB muscle to help you out on your harder English work. You are taking your skills to Shakespeare to find the rhyme scheme of a poem Function Description: Write a function in MATLAB that finds the rhyme scheme of a poem. The first input is a string and is the name of a file to read. The file will be some number of lines, and using the rhyming rules from the first problem (the last two letters of last word must match), you must find the rhyme scheme of the poem in the file. The rhyme scheme will be denoted as a string of capital letters, starting with 'A', where lines that rhyme have the same letter. That is, every line that rhymes with the first line will be an A, every line that rhymes with the next line (that doesn't rhyme with the first) is a 'B, and so on. There will not be more than 26 unique line endings (you will never need more than 'Z') Example: If the poem in the file is as follows Roses are red, Violets are blue This problem has led, Me straight to you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
