Matlab/Scilab Items

 

The following programs in Matlab and Scilab can be used to illustrate matrix functions and programming techniques.  (I created the Enigma example for use in Engineering Analysis 1 at Northwestern University.  The Sudoku example for generating these matrices is somewhat more involved but can be a larger project or just used as programming illustration.)

 

Enigma simulation: Descriptions of this encryption device are available in many places, e.g., Wikipedia at http://en.wikipedia.org/wiki/Enigma_machine .  The simulator here uses the full ascii character set (instead of just letters as in the original).  Some background appears in the presentation: enigmamatlab.pdf. The code is enigma.m. 

 

Sudoku generation/solution: These files solve and generate Sudoku 9x9 puzzles and solutions as 9x9 matrices.  The solver uses row-column-entry format as input. (A converter to go from full matrix to row-column-entry format is also linked here.)

-        sudokugen.m: generates puzzles (and solution as 2nd output argument);

-        sudokusol.m: solves puzzle;

-        sudokutran.m: converts 9x9 matrix to non-zero row-column-entry format;

-        sudokuformatexample.xls: Excel format for printing puzzle;

-        sudokugen2.sci, sudokusol2.sci, sudokutran.sci: translated codes in Scilab.