Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Function Name: scales Inputs: 1. (double) Vector of numbers representing notes 2. (char) Note you want to count Outputs: 1. (char) Vector of note names

Function Name: scales

Inputs:

1. (double) Vector of numbers representing notes

2. (char) Note you want to count

Outputs:

1. (char) Vector of note names

2. (double) Number of times the note specified in the input occurs

Background: You are an artist about to perform at Music Midtown. Before you go on stage, you better warm up! Normally you warm up by singing musical scales, but you decide try something different and use the set of warmups your friend gave you beforehand. However, she gave them to you in a weird format. You decide to use MATLAB to convert your friend's warmups into the notes that you understand!

Function Description: You have been given a vector of integers greater than or equal to 0. You want to make sure that you don't strain your voice before the big show, so you limit the range by deleting every number representing a note greater than 18. Each number corresponds to one of seven musical notes, whose names range from 'A' to 'G'. The numbers {0, 7, 14, ... } correspond to the note 'C', the numbers {1, 8, 15, ... } correspond to 'D', etc. The numbers {5, 12, 19, ... } correspond to 'A' and {6, 13, 20, ... } correspond to 'B'. Output a character vector of the note names that correspond to the numbers in the first input. Then, count how many times the note specified in the second input occurs in the vector, and output that count as the second output.

Example: [notes,count] = scales([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14], 'C')

notes = 'CDEFGABCDEFGABC'

count = 3

Notes: The mod() function will be useful.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions