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 252337

Submitted on 31 May 2013 by Tim

Correct

75Size
Leading solution size is 72.
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
 
phrase=upper('Between subtle shading and the absence of light lies the nuance of iqlusion.');
phrase_encode=phrase(regexp(phrase,'[A-Z?]'));
encoded_exp='EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD';
word1='KRYPTOS';
word2='PALIMPSEST';
encoded= encode_vigenere(phrase_encode,word1,word2);
assert(strcmp(encoded_exp,encoded))

                    
2
Pass
 
%%
phrase=upper('It was totally invisible Hows that possible? They used the Earths magnetic field X The information was gathered and transmitted undergruund to an unknown location X Does Langley know about this? They should Its buried out there somewhere X Who knows the exact location? Only WW This was his last message X Thirty eight degrees fifty seven minutes six point five seconds north Seventy seven degrees eight minutes forty four seconds west ID by rows');
phrase_encode=phrase(regexp(phrase,'[A-Z?]'));
encoded_exp='VFPJUDEEHZWETZYVGWHKKQETGFQJNCEGGWHKK?DQMCPFQZDQMMIAGPFXHQRLGTIMVMZJANQLVKQEDAGDVFRPJUNGEUNAQZGZLECGYUXUEENJTBJLBQCRTBJDFHRRYIZETKZEMVDUFKSJHKFWHKUWQLSZFTIHHDDDUVH?DWKBFUFPWNTDFIYCUQZEREEVLDKFEZMOQQJLTTUGSYQPFEUNLAVIDXFLGGTEZ?FKZBSFDQVGOGIPUFXHHDRKFFHQNTGPUAECNUVPDJMQCLQUMUNEDFQELZZVRRGKFFVOEEXBDMVPNFQXEZLGREDNQFMPNZGLFLPMRJQYALMGNUVPDXVKPDQUMEBEDMHDAFMJGZNUPLGEWJLLAETG';
word1='KRYPTOS';
word2='ABSCISSA';
encoded= encode_vigenere(phrase_encode,word1,word2);
assert(strcmp(encoded_exp,encoded))

                    
3
Pass
 
%%
phrase=upper('The fox jumped over the moon');
phrase_encode=phrase(regexp(phrase,'[A-Z?]'));
encoded_exp='VUIPFSBYVQMMWPIMEVPZCVK';
word1='KRYPTOS';
word2='MATLAB';
encoded= encode_vigenere(phrase_encode,word1,word2);
assert(strcmp(encoded_exp,encoded))

                    
4
Pass
 
%%
phrase=upper('Between the Devil and the deep blue sea');
phrase_encode=phrase(regexp(phrase,'[A-Z?]'));
word1='AWEIGH';
word2='MATLAB';
encoded= encode_vigenere(phrase_encode,word1,word2);
encoded_exp='SENMEDWTZNDDFIBLNNCHVTEDIBBCEZOA';
assert(strcmp(encoded_exp,encoded))