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 244343

Submitted on 14 May 2013 by James

Correct

224Size
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))
quests =
   Empty matrix: 1-by-0
new_lines =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10     1     2     3     4     5     6
  Columns 17 through 32
     7     8     9    10     1     2     3     4     5     6     7     8     9    10     1     2
  Columns 33 through 48
     3     4     5     6     7     8     9    10     1     2     3     4     5     6     7     8
  Columns 49 through 63
     9    10     1     2     3     4     5     6     7     8     9    10     1     2     3
encode_matrix =
PTOSABCDEFGHIJLMNQUVWXZKRY?
ABCDEFGHIJLMNQUVWXZKRYPTOS?
LMNQUVWXZKRYPTOSABCDEFGHIJ?
IJLMNQUVWXZKRYPTOSABCDEFGH?
MNQUVWXZKRYPTOSABCDEFGHIJL?
PTOSABCDEFGHIJLMNQUVWXZKRY?
SABCDEFGHIJLMNQUVWXZKRYPTO?
EFGHIJLMNQUVWXZKRYPTOSABCD?
SABCDEFGHIJLMNQUVWXZKRYPTO?
TOSABCDEFGHIJLMNQUVWXZKRYP?
encoded =
EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD
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))
quests =
    38   164   226
new_lines =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7     8
  Columns 17 through 32
     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7     8
  Columns 33 through 48
     1     2     3     4     5     5     6     7     8     1     2     3     4     5     6     7
  Columns 49 through 64
     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7
  Columns 65 through 80
     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7
  Columns 81 through 96
     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7
  Columns 97 through 112
     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7
  Columns 113 through 128
     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7
  Columns 129 through 144
     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7
  Columns 145 through 160
     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6     7
  Columns 161 through 176
     8     1     2     2     3     4     5     6     7     8     1     2     3     4     5     6
  Columns 177 through 192
     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6
  Columns 193 through 208
     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6
  Columns 209 through 224
     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5     6
  Columns 225 through 240
     7     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 241 through 256
     6     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 257 through 272
     6     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 273 through 288
     6     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 289 through 304
     6     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 305 through 320
     6     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 321 through 336
     6     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 337 through 352
     6     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 353 through 368
     6     7     8     1     2     3     4     5     6     7     8     1     2     3     4     5
  Columns 369 through 372
     6     7     8     1
encode_matrix =
ABCDEFGHIJLMNQUVWXZKRYPTOS?
BCDEFGHIJLMNQUVWXZKRYPTOSA?
SABCDEFGHIJLMNQUVWXZKRYPTO?
CDEFGHIJLMNQUVWXZKRYPTOSAB?
IJLMNQUVWXZKRYPTOSABCDEFGH?
SABCDEFGHIJLMNQUVWXZKRYPTO?
SABCDEFGHIJLMNQUVWXZKRYPTO?
ABCDEFGHIJLMNQUVWXZKRYPTOS?
encoded =
VFPJUDEEHZWETZYVGWHKKQETGFQJNCEGGWHKK?DQMCPFQZDQMMIAGPFXHQRLGTIMVMZJANQLVKQEDAGDVFRPJUNGEUNAQZGZLECGYUXUEENJTBJLBQCRTBJDFHRRYIZETKZEMVDUFKSJHKFWHKUWQLSZFTIHHDDDUVH?DWKBFUFPWNTDFIYCUQZEREEVLDKFEZMOQQJLTTUGSYQPFEUNLAVIDXFLGGTEZ?FKZBSFDQVGOGIPUFXHHDRKFFHQNTGPUAECNUVPDJMQCLQUMUNEDFQELZZVRRGKFFVOEEXBDMVPNFQXEZLGREDNQFMPNZGLFLPMRJQYALMGNUVPDXVKPDQUMEBEDMHDAFMJGZNUPLGEWJLLAETG
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))
quests =
   Empty matrix: 1-by-0
new_lines =
  Columns 1 through 16
     1     2     3     4     5     6     1     2     3     4     5     6     1     2     3     4
  Columns 17 through 23
     5     6     1     2     3     4     5
encode_matrix =
MNQUVWXZKRYPTOSABCDEFGHIJL?
ABCDEFGHIJLMNQUVWXZKRYPTOS?
TOSABCDEFGHIJLMNQUVWXZKRYP?
LMNQUVWXZKRYPTOSABCDEFGHIJ?
ABCDEFGHIJLMNQUVWXZKRYPTOS?
BCDEFGHIJLMNQUVWXZKRYPTOSA?
encoded =
VUIPFSBYVQMMWPIMEVPZCVK
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))
quests =
   Empty matrix: 1-by-0
new_lines =
  Columns 1 through 16
     1     2     3     4     5     6     1     2     3     4     5     6     1     2     3     4
  Columns 17 through 32
     5     6     1     2     3     4     5     6     1     2     3     4     5     6     1     2
encode_matrix =
MNOPQRSTUVXYZAWEIGHBCDFJKL?
AWEIGHBCDFJKLMNOPQRSTUVXYZ?
TUVXYZAWEIGHBCDFJKLMNOPQRS?
LMNOPQRSTUVXYZAWEIGHBCDFJK?
AWEIGHBCDFJKLMNOPQRSTUVXYZ?
BCDFJKLMNOPQRSTUVXYZAWEIGH?
encoded =
SENMEDWTZNDDFIBLNNCHVTEDIBBCEZOA