Problem 45282. Cryptography with A Square Matrix : Decoding
Now decode a double vector to a (hopefully!) meaningful text.
Inputs are encoded vector and key matrix.
encodedVector = [1665 1624 1541 1549 1495 1501 486 510 534 1503 1552 1595 1192 747 836]
key = magic(3);
inverse of key
inverseKey = [0.147222222222222 -0.144444444444444 0.0638888888888889
-0.0611111111111111 0.0222222222222222 0.105555555555556
-0.0194444444444445 0.188888888888889 -0.102777777777778];
Reshape encodedVector so it has the same number of rows with key
reshapedVector = [1665 1549 486 1503 1192;
1624 1495 510 1552 747;
1541 1501 534 1595 836];
Multiply inverseKey and reshapedVector, round it and reshape it;
messageVector = [109 97 116 108 97 98 32 38 32 99 111 100 121 32 32];
char equivalent of message vector is 'matlab & cody'
Solution Stats
Problem Comments
-
4 Comments
Show
1 older comment
Christian Schröder
on 28 Dec 2022
Your last two test cases do not actually test anything --- there's no assert() in these.
Dyuman Joshi
on 28 Dec 2022
There are no answers defined by the author to test the last 2 cases.
Christian Schröder
on 29 Dec 2022
@Duyman the missing correct answers are, respectively, 'backorder is an accumulation of customer orders that a manufacturer has promised for delviery at some future date.' and 'abc'.
Christian Schröder
on 29 Dec 2022
(And yes, it really says 'delviery'; the original author probably had a typo in there he didn't catch.)
Solution Comments
Show commentsProblem Recent Solvers10
Suggested Problems
-
Remove all the words that end with "ain"
2298 Solvers
-
Get the area codes from a list of phone numbers
1054 Solvers
-
840 Solvers
-
163 Solvers
-
Unique values without using UNIQUE function
352 Solvers
More from this Author92
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!