Introduction to FreeMat

Embed Size (px)

DESCRIPTION

Learn the basics of using MATLAB and FreeMat

Citation preview

2. In this workshop we will cover the following Using FreeMat as a numerical calculator Entering row vectors and column vectors Entering matrices Forming matrix and vector products Doing matrix products, sums etc Using FreeMat to solve linear equations FreeMat functions that operate on arrays Plotting basic graphs using FreeMat. Introduction to FreeMat 3. What is MATLAB ? MATLAB started as an interactive program for doing matrix calculations and has now grown to a high level mathematical language that can solve integrals and differential equations numerically and plot a wide variety of two and three dimensional graphs. MATLAB also contains a programming language.Introduction to FreeMat 4. What is FreeMat? FreeMat is an open source software package that provides all the basic functions of MATLAB It lacks the sophisticated toolboxes provided by the MATLAB, but it works perfectly if you use basic functions!Introduction to FreeMat 5. How to get started?Introduction to FreeMat 6. Simple arithmetic with MatlabIntroduction to FreeMat 7. Simple arithmetic with MatlabIntroduction to FreeMat 8. Try These!Introduction to FreeMat 9. The order of operations If you are using brackets, that will save you a lot of effort! However, the operators have precedence! 1. 2. 3. 4.( ) brackets ^ Power * / Multiplication and division + - Addition and subtractionIntroduction to FreeMat 10. Variable names Variable may have names that consist of characters and digits, but they can not start with a number! Matlab distinguishes between lower and upper cases - so A and a are different objects Only the first 19 characters in a variable name are important.Introduction to FreeMat 11. Try this! You have just created two vectors, x & y! Now try some operations on them! (multiply by a constant, use sin(x), sqrt(x), exp(x), Introduction to FreeMat 12. Try this!Introduction to FreeMat 13. This is your first plot!Introduction to FreeMat 14. How about this?Introduction to FreeMat 15. Now, you know how to create a plot of your data!Introduction to FreeMat 16. Matrix Operations Try these:Introduction to FreeMat 17. Another way of creating a vector You may try to multiply, add, or invert those matrices!Introduction to FreeMat 18. Matrix Inversion Matrix inversion is performed using the function: inv();Introduction to FreeMat 19. What variables have you defined already ? Also try the commands: who & whos Introduction to FreeMat 20. More Matrix Operations Try these:Introduction to FreeMat 21. More Matrix OperationsIntroduction to FreeMat 22. Special Matrices!Introduction to FreeMat 23. Solving Equations! Now we may use the tools we have to solve a system of equations! If we have the equations: 5x + 3 y z = 7 x 2 y + 9z = 8 x + 2 y + 3z = 6 Just transform it into matrix form! Introduction to FreeMat 24. Here is how!Introduction to FreeMat 25. Or Even Easier!!! Actually, if you are solving a large system of equations, this operator is MUCH faster!Introduction to FreeMat 26. The last function for today! Timing function: tic toc Tic: starts the timer Toc: stops the timer and gives you the time in seconds!Introduction to FreeMat 27. More topics! Complex numbers Working with files More graphics Programming Symbolic OperationsIntroduction to FreeMat