Category Archives: Measurements

Multi plot in Origin 9

Multi plot in Origin 9

In this post, the methodology to plot multi plots in Origin will be discussed. Origin is a computing platform to interactively plot and analyse data, and is produced by OriginLab. This is one of the most invaluable and necessary tool for scientific data analysis and plotting.

The debate between Matlab plot and Origin plot depends on the user and I will leave it  for open discussion. All that can be said is both the programs are equally good, and depending on the problem statement one can use either of the tool.

In this post, the process of plotting multiple plots will be discussed using different set of data.

Origin offers multiple way of doing this and some are shown below:

  • Trivial way

In this, the selected data can be arranged in adjacent columns, and using the plot function in  the toolbar, the data is plotted as shown.

Simple way of plotting using adjacent coloumns

Simple way of plotting using adjacent coloumns

  • Stack by offsets

In this plotting technique, the data are stacked using y-offsets. It can be plotted using the Plot-Multi plot-Stack by y offset. An example figure is shown below

Stacking by y-offset

Stacking by y-offset

  • Multi-stack plot

This is by far the most important form of multiple stack plot in which each of the data columns are plotted in individual cells and are stacked on top of the other.  An example is shown below:

Multiple Stack plot

Multiple Stack plot


There are multiple other ways to perform multi-plots. These options can be found in the Plot function in the toolbar, and the reader can try the various functions.

An evaluation version of Origin can be found here.

Tr-AMR angle

Obtaining magnetization orientation from magneto resistance

Obtaining magnetization orientation from magneto-resistance

Magnetism is a fascinating subject, not in terms of the science and understanding of it, but in terms of the application it has unfolded in the recent years. With the discovery of the Giant Magnetoresistance effect, which led to the birth of spintronics, technology around us has changed drastically and rapidly.  Data storage has transformed from bulky HDD s to more recent MRAMS, and DRAMS.

Spintronics which means the field of study on spin dependent magnetism phenomena, has done great  invaluable impacts not only to the storage industry but to the communication industry as well.  I will try to post more articles about the history of spintronics and their practical implications in another post .

As such, it can be realized that it is very much necessary to understand the process of the magnetization change in order to have any product designed out of it. One such tool to probe the magnetic property of a material is by performing a magneto resistance measurement of the material.

However the measured magneto-resistance is obtained  in units of resistance (ohms) and therefore it becomes necessary to extract the magnetization angles from the resistance to understand a quantitative magnetization switching process.   In this post, I have included a code, which converts the measured transverse anisotropic magneto resistance into magnetization angle with respect to the [010] crystal axes.

It is quite useful to have the AMR in terms of magnetization angle, because we can then explain the path of the reversal process, and design materials to alter or control the magnetization.

Find the code here:

GitHub link.  for the code.




A simple moving point average in Matlab

A simple  moving point average in MATLAB.

A moving average or a rolling average is one of the most common smoothing technique used to extract a good signal out of a very random noisy signal. This technique is usually used to see the behavior of a function or  a signal, when the physical parameters and environment have an erroneous effect on the measured signal.

Given a series of numbers and a fixed subset size, the first element of the moving average is obtained by taking the average of the initial fixed subset of the number series. Then the subset is modified by “shifting forward”; that is, excluding the first number of the series and including the next number following the original subset in the series. This creates a new subset of numbers, which is averaged. This process is repeated over the entire data series. The plot line connecting all the (fixed) averages is the moving average. A moving average is a set of numbers, each of which is the average of the corresponding subset of a larger set of datum points. A moving average may also use unequal weights for each datum value in the subset to emphasize particular values in the subset.

The general technique involves finding the mean  from an equal number of data on either side of a central value. This ensures that variations in the mean are aligned with the variations in the data rather than being shifted in time. There can be some anomalies when the variation is not uniform as well, but this will not be discussed here.

There can be different types of moving point averages like  the

  • Cumulative moving average
  • Weighted moving average
  • Exponential moving average
  • Modified moving average, and
  •  Regression  moving average methods

In this post I have attached a MATLAB code to do a simple moving average. This code can be used to smooth a signal with some nice feature but with a small background noise without compromising on the data value. But be careful on the window span of the average for your own data.

Find the code here:




Multi-curve fitting in Origin Pro.

Multi-curve fitting in Origin Pro.

Origin is a data processing and analyzing software and probably one of the most popular software choice to analyse data in industry,academia and laboratories. The versatility of the software is its easy to use, updates in real time, robust analysis, import and export capabilities even to LATEX. I will recommend this software to anyone who spends lot of time crunching numbers and getting some sweet results from it.

Yes, Matlab can do curve fit as well using cftool option. Yet there are some functions which can get a bit complicated with matlab fit tool, and also the energy to write a code when you can use ready to use  functions( in thousands) to do that for you.

In this article, I have attached a video tutorial to show how a double Lorentz function is fitted to a signal data to get the half width, peak center etc of the signal.

You can find the video in the link here.

Normalization between -1 and 1


Normalization between -1 and 1

Normalisation (or Normalization) is a very elegant and a necessary statistical process of data analysis. It can have a wide variety of meanings depending on the data and the output we wish for. Some of the common meanings of data normalization are as below:

There are various equations and methods to do the statistical normalization.  Readers can always follow a text book to read more about the statistical parts and the maths of the normalization.

In this post, I talk about an algorithm to normalize a data between -1 and 1. Normalizing data between this range is a necessary part of the experimental analysis of data.

You can download the code from here.

The logic lies in the fact that , the program finds the max and min of the data set and averages the rest of the data set from the difference of the max and min. By employing this, data redundancy and noise interference can also be reduced without doing further data averaging or processing.

The code can also be used to normalize the data between any user given range not necessarily -1 and 1.