Now, use plot(x,y) to generate Figure 2.3 (a) using vector x and y. Just like Matlab and Octave, we can load the data in a matrix A with A = load(’matlabdata.dat’) command and use x = A(:,1) to create vector x and y = A(:,2) to create y. Let us begin by examining the load command. To examine the plotting feature of FreeMat, we will consider f(x) = x sin(x2). Now we would hope to see an agreement in the plotting and annotation commands.
So the commands used to solve systems of operations, calculate eigenvalues and eigenvectors, and computing matrix inverse are same as Matlab.Ģ.3.3 2-D Plotting from a Data File in FreeMat Which results in the matrix A as following:Ī key point here is that FreeMat uses inv to compute inverse of matrices. The outcome is identical to Matlab’s results. We will use FreeMat’s built-in-function eig and obtain the following result: For our computations, let us use matrix A stated in Section 2.1.2. Now, we will consider the second important operation, computing eigenvalues and eigen- vectors. Like Matlab and Octave, FreeMat also uses the backslash operator to solve linear systems.Ģ.3.2 Calculating Eigenvalues and Eigenvectors in FreeMat We can use the same commands a Matlab to produce a result.Īs we had expected. Let us consider matrix A as defined in Section 2.1.1. We will begin by first solving a linear system. Figure 2.2: Plots of f(x) = x sin(x2) in Octave using (a) 129 and (b) 1025 equally spaced data points.Ģ.3.1 Solving Systems of Equations in FreeMat