List the notes of a major scale - MATLAB Cody - MATLAB Central

Problem 60839. List the notes of a major scale

Difficulty:Rate
If you have seen The Sound of Music, then you are familiar with the major scale: do, re, mi, fa, sol, la, ti, do. The C major scale, for example, is C, D, E, F, G, A, B, C.
Notice the pattern that defines a major scale: a whole step (two notes) from C to D, a whole step from D to E, a half step (one note) from E to F, whole step, whole step, whole step, and half step. The Ab (A flat) major scale would be Ab, Bb, C, Db, Eb, F, G, Ab, and the E major scale would be E, F#, G#, A, B, C#, D#, E.
Also notice on the image of the keyboard below that the black notes have two names. Thus, the G# (G sharp) major scale—G#, A#, C, C#, D#, F, G, G#--is the same as the Ab major scale but with the sharp names rather than the flat names. The major scales that use flats are Db, Eb, F, Gb, Ab, and Bb.
Write a function to list the notes of a major scale, starting on the specified note of the scale (or, if not specified, the first note).

Solution Stats

80.0% Correct | 20.0% Incorrect
Last Solution submitted on Apr 08, 2025

Problem Comments

Solution Comments

Show comments
Registration Now Open for MathWorks AUTOMOTIVE CONFERENCE 2025
...
Hello Community, We're excited to announce that registration is now open for the...

Problem Recent Solvers4

Suggested Problems

More from this Author298

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page