MATLAB and Scilab Comparison Jill Ziegler Hamilton High West Hamilton, NJ MATLAB code: Program Structure, Functions, and Syntax • • Very closely paralleled most structure and functions identical • • some functions with same name but different results • • xlabel and ylabel functions in this example are identical the axis function shown in the MATLAB code will produce in Scilab, if proper arguments are provided, draw an axis in the output window independent of the rest of the figure some functions with identical results but different name or syntax • • note the difference in comment lines hist and histplot are notable in the examples shown Scilab code: Layout and Workspaces • • • Very functionally similar MATLAB has a layout more like the most recent versions of MS Office (icons with explanatory text beneath) while Scilab has the icons alone with explanatory text available by hovering the mouse Same subwindows • • • • • file browser command window variable workspace command history Both can dock and undock all subwindows in the main window Editor Window Toolbars • Differences and similarities parallel from the main workspaces • • icons with text as opposed to icons with hover text Toolbar design different in style, but provides similar functionality • • MATLAB has functionality available through different tabs in the toolbar Scilab has more of the functionality available through drop-down menus Graphing: function plots • • MATLAB function plot While syntax is slightly different between MATLAB and Scilab, function plots that are essentially the same can be produced Significant difference: • • • • • • MATLAB will clear the plot if another plot command is given multiple functions on the same axis must be done in the same statement or the hold plot function must be used allows easy, smooth animation of plots: simply use another plot statement to create the next “frame” Scilab plots do not clear unless a clear command is given multiple functions on the same axis are easy smooth animation is harder and has so far remained elusive Scilab function plot Graphing: Histograms • Note: differences in the profile of the two histograms results from the fact that they are both generated from a random process and any two histograms from the same program would look a bit different • • code producing these plots is the code shown in an earlier slide Differences in appearance that don’t affect functionality • • MATLAB Histogram color and tick marks Functions in each program are significantly different • • • • MATLAB hist function puts the data first in the statement, followed by the number of bins Scilab histplot function puts the number of bins first, followed by the data Scilab also defaults to a normalized histogram If a non-normalized histogram is desired, an argument must be provided in the histplot function to specify this Scilab Histogram Major Differences • Cost and accessibility: – MATLAB is paid software with proprietary code – Scilab is free and open source • more accessible • may be less support, especially for add-on modules • Plot clearing: – MATLAB clears one plot automatically when another one is plotted – Scilab leaves all plots on the same axis unless cleared • GUIs – MATLAB comes standard with a GUI builder, GUIDE, built in – Scilab does not • at least 4 GUI building modules are available for download (none tried as of this writing) Help and Documentation MATLAB Scilab • extensive help available through built-in library • more help available on-line, including videos • extensive help available through built-in library • more help available on-line (main website at http://www.scilab.org/resources/ documentation) – most help available through Mathworks website • Good textbook available for individual or class use that we’ve used: – Lent, Craig S.: Learning to Program with MATLAB: Building GUI Tools – several pdf user tutorials at various levels, including for “very beginners” available at http://www.scilab.org/resources/d ocumentation/tutorials – texts available for high school use in math and engineering, currently only in French – limited videos, but has YouTube Channel (user ScilabChannel) Concluding Thoughts • Either MATLAB or Scilab will do the kinds of graphing and analysis we’re looking for • Either program can be used to learn mathematical programming using matrices • Programs in one language can be adapted rather easily to run in the other • GUI capability of MATLAB is proven, Scilab is not – Seems to be available