Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 216240

Submitted on 12 Mar 2013 by Alfonso Nieto-Castanon

Correct

42Size
This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
[c,s]=chromatic_tuner(440);
assert(c==0 && strcmp(s,'A4'));

                    
2
Pass
 
%%
[c,s]=chromatic_tuner(154);
assert(c==-17 && strcmp(s,'D#3'));

                    
3
Pass
 
%%
[c,s]=chromatic_tuner(478);
assert(c==43 && strcmp(s,'A#4'));

                    
4
Pass
 
%%
[c,s]=chromatic_tuner(795);
assert(c==24 && strcmp(s,'G5'));

                    
5
Pass
 
%%
[c,s]=chromatic_tuner(8651);
assert(c==-43 && strcmp(s,'C#9'));

                    
6
Pass
 
%%
[c,s]=chromatic_tuner(200);
assert(c==35 && strcmp(s,'G3'));

                    
7
Pass
 
%%
[c,s]=chromatic_tuner(11534);
assert(c==-45 && strcmp(s,'F#9'));

                    
8
Pass
 
%%
[c,s]=chromatic_tuner(163);
assert(c==-19 && strcmp(s,'E3'));

                    
9
Pass
 
%%
[c,s]=chromatic_tuner(7226);
assert(c==45 && strcmp(s,'A8'));

                    
10
Pass
 
%%
[c,s]=chromatic_tuner(2391);
assert(c==30 && strcmp(s,'D7'));

                    
11
Pass
 
%%
[c,s]=chromatic_tuner(17221);
assert(c==49 && strcmp(s,'C10'));

                    
12
Pass
 
%%
[c,s]=chromatic_tuner(11050);
assert(c==-20 && strcmp(s,'F9'));

                    
13
Pass
 
%%
[c,s]=chromatic_tuner(40865);
assert(c==45 && strcmp(s,'D#11'));

                    
14
Pass
 
%%
[c,s]=chromatic_tuner(37396);
assert(c==-9 && strcmp(s,'D11'));

                    
15
Pass
 
%%
[c,s]=chromatic_tuner(789);
assert(c==11 && strcmp(s,'G5'));

                    
16
Pass
 
%%
[c,s]=chromatic_tuner(9870);
assert(c==-15 && strcmp(s,'D#9'));

                    
17
Pass
 
%%
[c,s]=chromatic_tuner(306);
assert(c==-29 && strcmp(s,'D#4'));

                    
18
Pass
 
%%
[c,s]=chromatic_tuner(96);
assert(c==-36 && strcmp(s,'G2'));

                    
19
Pass
 
%%
[c,s]=chromatic_tuner(13513);
assert(c==29 && strcmp(s,'G#9'));

                    
20
Pass
 
%%
[c,s]=chromatic_tuner(2489);
assert(c==0 && strcmp(s,'D#7'));

                    
21
Pass
 
%%
[c,s]=chromatic_tuner(2166);
assert(c==-41 && strcmp(s,'C#7'));