Recording Voice from Mic in Matlab

Below is sample code for recording voice from mic in matlab:



Drafting in Octave/Matlab

Plotting package of octave is very powerful. It can be used to plot architectural drawings. Following steps are required:

  1. Sketching the layout on paper while noting down the points and labeling it.
  2. Afterwards, the coordinates of point is calculated.
  3. Commands of line, gtext and axis limits are used.

For demo, m-file named drawoschool.m (draw octave school) is created which can be downloaded from here

To use this m-file, type:

Architectural Drafting in GNU OCTAVE
Architectural Drafting in GNU OCTAVE

MATLAB Tutorials

Following are MATLAB tutorial available to download:

  1. MATLAB for Civil Engineers
  2. Plotting in MATLAB
  3. Functions and Programming Control Structures in MATLAB
  4. Symbolic, Numerical Calculus and Linear Algebra

Solver based on Direct Stiffness Method

DSM-SOLVER is based on Direct Stiffness Method.  Direct Stiffness Method is implementation of Finite Element Method. It is available in two flavors. One is octave/matlab while other is scilab script and distributed under GNU/GPL v2.0 license.

GNU Octave is free clone of matlab. It is fully compatible with matlab.

Scilab is an open source, cross-platform numerical computational package and a high-level, numerically oriented programming language. Scilab is alternative to matlab.

You can download the source-code of DSM-OCTAVE-SOLVER or  DSM-SCILAB-SOLVER. To understand how this script works,  read the document provided along with the source files. Consider the following example:

scilab dsm example
Example Problem

The above example can be solved in one of the two scripts explained as under:

For Octave/Matlab example, first define some input variables as:


To run the program, you need to update the directory to src folder, then, write following:

Note that truss2d has same code as that of frame 2d. You can get pretty accurate result for trusses by considering it as frame.


For SCILAB example, the input matrices and command for making var01.bin as provided in the preproc.sce file are:

To run the program, you need to update the directory to src folder, then, write following:

Contour Plot using Matlab

You can plot contour map in Matlab. All you need is following:

  1. Download the zipped file of contourmatlab that contains m files, xls file of sample data and world mat file. The file is distributed under GNU/GPL v2.0 license.
  2. Extract the zipped file of contourmatlab to required directory.
  3. Open matlab and set your current directory of matlab to the extracted folder.
  4. Change the data in data.xls file to your own data. Remember that first column is latitude, second is longitude, both in decimals. While third column is value which you want to plot in contour. Same Latitude and Longitude should not repeat in rows.  For good contour plot, given data should be well distributed.
  5. In matlab command line, type:  plotcont
  6. Your contour will be plotted.
  7. To change the region of your plot or spacing of the plot data, you must edit plotcont.m file.

    Figure of Contour Plot on Pakistan Map.
    Fig1. Contour Plot on Pakistan Map.

You can use this file to plot the elevation contour of given region. All you need is to take latitude, longitude and elevation data for the required region. You can use google earth for this or if only elevation data is required then use online elevation profile.