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.

 

 

abu002

Manipulating a string in MATLAB

Manipulating a string in MATLAB.

Following the previous post, where a string can be modified at vowel locations, and written over several times in a cyclic order, this post is about some more  vowel manipulation using Matlab.

So, after the previous post, my colleagues at work gave me a new challenge to do in Matlab. The problem statement was :Matlab is given a string (aka statement) which is a general combination of a lot of vowels and constants that make up words. Say for example like this:

monkeys like eating bananas that are ripe and yellow.

Assuming all the letters are in small ( program can be edited to have letter sin both caps and small as well) , the program reads through the statement and replace the last vowel in every word with nothing , or just truncates it. To add to the challenge the solution must be done without using an inbuilt library functionality.

Therefore after doing what has been asked for, the final output should be this :

monkys lik eatng banans tht ar rip nd yellw.

So,  attempted to solve this using matlab and you can find the code here:

Code here:

The way I solved is this. I am sure there can be several other ways to do that, and I am looking forward to hear from you in the comments section.

My algorithm:

  1. Add a space to the end of the string.
  2. Find the number of spacer by iterating through the string and checking for integer value of each character. The ASCII value of space is 32.
  3. The number of space is equal to the number of words then. Since we have added an extra space to the end.
  4. Now ask matlab to loop through each word. This can be done by space locations and first character. It can be made simpler by adding a space to the beginning of the statement as well. Then the whole string is homogeneously spaced.
  5. Fing the index of vowels in each word.
  6. list the index of each vowel
  7. Remove it by using a logical indexing operation.
  8. Print it.
  9. And you are done !

Download code here.

Let me know about your algorithm in the comment sections.

 

 

 

 

 

brownfox

Writing Impositions in Matlab

Writing Impositions in Matlab

This post is for students who do not do their homework (like me when I was in school) and are punished with writing impositions. The imposition would usually be writing something like a very long statement with no meaning several times. Like back in my school days, when we were told to write them on paper using a pen or pencil. But these days students and truants are asked (ordered!) to write them in a word-processing software. Well, we can think of using the classic trick of Ctrl+C and Ctrl+V, but it depends on the imposition type, right!

Like for say here, we are asked to write this statement :

“The quick brown fox jumps over the lazy dog”.

And the teacher asks you to change every vowel with its preceding vowel in each iteration.That would mean , in my first statement, a is replaced to e, e is replaced by i, i is replaced by o, o is replaced by u, and u is replaced by a. In subsequent iterations, the replaced vowels are replaced by their preceding vowel. And this has to be done say 100 times. (Quite a tough punishment!). This case can not be done in MS Word or any other word processor, so the student has to do type this manually each time or just do his homework instead.

However, good news! I have a Matlab code for you, which will do it for you however number of times you want to write. In the end, all you have to do copy the final output to a word processor  and get the print. The code is as simple it can be without using any library functions so that people with no knowledge about Matlab can still use, because then it is just English to understand.

You can get the code here, and use an online compiler to run it .

Download code here:

 

 

datasync

Data syncing and backUP

When we look around us , we are surrounded by data and a lot of information. But in this post I will not be talking about those objects (as they are called in object oriented programming). In this data refers to all the qualitative and quantitative set of information and variables we have stored in our computer. These data be it just collected, reported or even analysed are very crucial for every one. Every individual encounters different type of data. This page will classify different types of data for interested readers.

This post focuses on data back up and syncing. In simple words, it is the act of replicating data between two storage units, but the storage needs to be mirrored. That means change to one will be reflected to the other and vice versa. The advantage of this is that it saves a lot of time than the general copy pasting, and of course it is the ability to preview the changes before they are actually made.

For syncing there are various software in the market, some commercial and some open source applications.  Personally ,I use SyncToy, and have described the process to sync in this post. The good things about this software is it is a freeware and it has a very simple GUI to get the work done.

So here we go.

  1. Install the SyncToy software by downloading it from here.
  2. Once installed, open up the application.
  3. On the window that pops up, click on Create New Folder Pair.
  4. Now choose the folders that you want to sync. Left is the source folder path, Right is the target source folder path.
  5. Click NEXT.
  6.  The next window that follows asks about the type of sync, viz;
    Synchronize: Updates files both ways…keeping changes like renames, deletions and edits to either folder contents the same between the two.
    Echo: New and updated files are copied left to right. Renames and deletes on the left are repeated on the right.
    Contribute: New and updated files are copied left to right. Renames on the left are repeated on the right. No deletions.
  7.  I will recommend using the Contribute option.
  8.  After that, name your syncing action. Choose a suitable name in case you are syncing between different target sources. Click FINISH
  9. On the next window, click RUN, to see the software syncing your data from the source path to the target path.
  10. Once done, click CLOSE to see the report of syncing
  11. To schedule the syncing automatically,  go to Task Scheduler option in windows 7.
  12. Click on Create basic Task
  13. Next type a little name and description to the task like ” DataSYNC SyncToy”
  14.  Go to the trigger option, and select the frequency of syncing up to your convenience.
  15. In the Action tab of the window,  type “C:\Program Files\SyncToy2.1\SyncToy.exe” where it asks for Program/Script.
  16. In the add argument section, type -R
  17. Click Finish to get things done.
  18. Have it a go !