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
-
2409 Solvers
-
Omit columns averages from a matrix
586 Solvers
-
567 Solvers
-
Back to basics 12 - Input Arguments
596 Solvers
-
Calculate the height of an object dropped from the sky
248 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!