Procedure for Generating Graphs Using GUI in MATLAB

7
4 easy step procedure for generating graphs using GUI in MATLAB Run the experiments e.g. LEACH. Export/copy the target variable (array) (say Live, highlighted in gray in STEP 1 figure below) in the workspace to excel. Do this for each of the protocol you are interested in comparing with LEACH e.g. SEP or SEP-E. See the snapshot below : o STEP 1: Run experiment and copy the variable of interest say Live from Matlab workspace. (Do this for each of the protocols you want to compare)!!!

description

about matlab procedure graph

Transcript of Procedure for Generating Graphs Using GUI in MATLAB

  • 4 easy step procedure for generating graphs using GUI in MATLAB

    Run the experiments e.g. LEACH. Export/copy the target variable (array) (say Live,

    highlighted in gray in STEP 1 figure below) in the workspace to excel. Do this for each of the

    protocol you are interested in comparing with LEACH e.g. SEP or SEP-E. See the snapshot

    below :

    o STEP 1: Run experiment and copy the variable of interest say Live from Matlab

    workspace. (Do this for each of the protocols you want to compare)!!!

  • o STEP2: Paste Live variables to excel for LEACH, SEP and SEP-E (forget about the

    naming it was meant for me to be able to distinguish what I copied from MATLAB!!!)

    See the figure below:

    o STEP 3: Save the excel sheet and import it back to MATLAB (open Matlab). Click

    File>Import Data> (select your directory where you save the excel file)> the import

    wizard is open >click Next>choose the 3rd option (Create vectors from each row

    using names)>Select the variable you want to import> click Finish. Now you can see

    the variables you have imported in the MATLAB workspace. This process is shown in

    the figures below:

  • o STEP 4: Select the variable you want to plot, one at a time e.g. I will select

    LEACHHeter and then click on the 2D line graph plot (shown in blue). See below:

  • Next click on the Show plot tools and Dock figure in the Matlab menu (the last option to the

    right in the Figure 1 graph) shown in the picture below

    Right click on the figure after it is docked!!! You will get a drop-drown menu>select Add Data

    shown below

  • In the window that pops up, choose the other variable you want to compare with e.g. I will

    choose SEP_3 and click Ok, as shown below. Repeat this step to add more variable to the

    Figure.

    You will see the new graphs shown in the new Figure. Now you can see two lines, one for

    LEACHHeter and the other SEP_3 (depending on your naming!!!). This is shown below.

  • The rest is a cup of cake!!! Depends on whether you want to include label, you want to

    change the X limits (currently it is from 0 to 1000, you can try changing it to see the behavior

    of the graph). You can name the axis in the X Axis/Y Axis>X /Y Labels (by typing in text that

    you want). Click on Insert Legends in the menu, it will insert the labels for you. And you can

    click directly inside the Legends to name it appropriately. You can change the line color, type

    and size by clicking each of the lines in the graph and changing the properties etc. The rest is

    for you to play around with. BRAVO!!!