a = rand(2,2) a = 0.9501 0.6068 0.2311 0.4860 % with diary we create log files, which enable is to view % our sessions; the files created with diary are text files % with the save command we can store data: save h:\mydata save h:\mydata.mat clear % clear the workspace to test the save a ??? Undefined function or variable 'a'. load h:\mydata a a = 0.9501 0.6068 0.2311 0.4860 % files created with save are files with data only accessible % to MATLAB b = rand(2,1) % random column vector b = 0.4565 0.0185 % we have a system a*x = b x = a\b x = 0.6551 -0.2735 b - a*x ans = 1.0e-016 * 0 -0.2776 residual = ans residual = 1.0e-016 * 0 -0.2776 % we can change the format into long: format long e x x = 6.551123326301300e-001 -2.735037909764516e-001 r ??? Undefined function or variable 'r'. residual residual = 0 -2.775557561562891e-017 % one alternative is the row reduced echelon form (rref) % on the augmented matrix [ a b ]: ab = [a b] ab = 9.501292851471754e-001 6.068425835417866e-001 4.564676651683414e-001 2.311385135742878e-001 4.859824687092997e-001 1.850364324822440e-002 format short e ab ab = 9.5013e-001 6.0684e-001 4.5647e-001 2.3114e-001 4.8598e-001 1.8504e-002 a a = 9.5013e-001 6.0684e-001 2.3114e-001 4.8598e-001 b b = 4.5647e-001 1.8504e-002 rab = rref(ab) rab = 1.0000e+000 0 6.5511e-001 0 1.0000e+000 -2.7350e-001 % to verify our result, we need to select the last column: sol = rab(:,3) sol = 6.5511e-001 -2.7350e-001 A = ab(:,1:2) % coefficient matrix as columns 1 and 2 of ab A = 9.5013e-001 6.0684e-001 2.3114e-001 4.8598e-001 B = ab(:,3) % right hand side vector B = 4.5647e-001 1.8504e-002 r = norm(B-A*sol) r = 5.5511e-017 % we take the norm of the residual vector to verify the solution help format FORMAT Set output format. All computations in MATLAB are done in double precision. FORMAT may be used to switch between different output display formats as follows: FORMAT Default. Same as SHORT. FORMAT SHORT Scaled fixed point format with 5 digits. FORMAT LONG Scaled fixed point format with 15 digits. FORMAT SHORT E Floating point format with 5 digits. FORMAT LONG E Floating point format with 15 digits. FORMAT SHORT G Best of fixed or floating point format with 5 digits. FORMAT LONG G Best of fixed or floating point format with 15 digits. FORMAT HEX Hexadecimal format. FORMAT + The symbols +, - and blank are printed for positive, negative and zero elements. Imaginary parts are ignored. FORMAT BANK Fixed format for dollars and cents. FORMAT RAT Approximation by ratio of small integers. Spacing: FORMAT COMPACT Suppress extra line-feeds. FORMAT LOOSE Puts the extra line-feeds back in. help HELP topics: matlab\general - General purpose commands. matlab\ops - Operators and special characters. matlab\lang - Programming language constructs. matlab\elmat - Elementary matrices and matrix manipulation. matlab\elfun - Elementary math functions. matlab\specfun - Specialized math functions. matlab\matfun - Matrix functions - numerical linear algebra. matlab\datafun - Data analysis and Fourier transforms. matlab\polyfun - Interpolation and polynomials. matlab\funfun - Function functions and ODE solvers. matlab\sparfun - Sparse matrices. matlab\graph2d - Two dimensional graphs. matlab\graph3d - Three dimensional graphs. matlab\specgraph - Specialized graphs. matlab\graphics - Handle Graphics. matlab\uitools - Graphical user interface tools. matlab\strfun - Character strings. matlab\iofun - File input/output. matlab\timefun - Time and dates. matlab\datatypes - Data types and structures. matlab\winfun - Windows Operating System Interface Files (DDE/ActiveX) matlab\demos - Examples and demonstrations. toolbox\symbolic - Symbolic Math Toolbox. wavelet\wavelet - Wavelet Toolbox. wavelet\wavedemo - Wavelet Toolbox Demos. toolbox\stats - Statistics Toolbox. images\images - Image Processing Toolbox. images\imdemos - Image Processing Toolbox --- demos and sample images nnet\nnet - Neural Network Toolbox. nnet\nndemos - Neural Network Demonstrations. nnet\nnutils - (No table of contents file) nnet\nnobsolete - (No table of contents file) signal\signal - Signal Processing Toolbox. signal\siggui - Signal Processing Toolbox GUI signal\sigdemos - Signal Processing Toolbox Demonstrations toolbox\optim - Optimization Toolbox. toolbox\ident - System Identification Toolbox. toolbox\control - Control System Toolbox. control\ctrlguis - Control System Toolbox -- GUI support functions. control\obsolete - Control System Toolbox -- obsolete commands. toolbox\tour - MATLAB Tour MATLAB53\work - (No table of contents file) toolbox\local - Preferences. For more help on directory/topic, type "help topic". save h:\mydata diary off