Hints:
Math operations:
Distinguishing between different multiplying and exponential options.
* is what we usually use to mean multiplication and that works in FreeMat for simple numbers. Many times, however, what looks like a simple variable 'x' is actually a vector composed of many elements as in x = [1,2,1,4,3]. If I want to compute x*x when x is a vector there is some ambiguity about what I mean. In FreeMat x.*x (notice the . before the *) tells FreeMat to multiply the first element times the first element and the second times the second and so on. The result is a vector x2 where each element in x2 is the square of the comparable element in x. The same holds true for the ^ as an indicator of raising to a power. For vectors one needs to use x.^3 to get the desired result.