Given an input string with the scientific pitch notation for standard tuning ( http://en.wikipedia.org/wiki/Guitar_tunings#Standard_tuning ) of a guitar string (e.g. 'E4'), return the frequency (to nearest whole number) in hertz (in this case, 330).
Many solutions depend on the tested inputs... Is there a way to prevent it ?
I posted 2 working solutions, they're not the shortest, but at least, they work with ANY input (C0, B10...), not just the tested ones!
Almost all working solutions are just a plain lookup tables : boring.
Works for all 70 natural notes between 'C0' (16Hz) and 'B9' (15804Hz)
Only works for tested inputs
tried D6 => 147 instead of 1175
Which doors are open?
Word Counting and Indexing
Project Euler: Problem 7, Nth prime
Back to basics 9 - Indexed References
Sum the Digits of a Number
Figurate number triangle
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office