diff options
author | Chayan Bhawal | 2018-09-27 11:04:57 +0530 |
---|---|---|
committer | Chayan Bhawal | 2018-09-27 11:04:57 +0530 |
commit | def3641770c8797c52ccef0840685fded209bfaa (patch) | |
tree | 0eee5ac05cc44e825eaf9505fd1954f91ea59a43 | |
parent | 45a65e87fd94819ea5353f56ec2470422578f03c (diff) | |
download | scilab-tutorials-def3641770c8797c52ccef0840685fded209bfaa.tar.gz scilab-tutorials-def3641770c8797c52ccef0840685fded209bfaa.tar.bz2 scilab-tutorials-def3641770c8797c52ccef0840685fded209bfaa.zip |
Tutorial1_plotting
-rw-r--r-- | Tutorial1/Data/.~lock.Tut1_data2.csv# | 1 | ||||
-rw-r--r-- | Tutorial2/Data/Tut2_data1.csv (renamed from Tutorial1/Data/Tut1_data2.csv) | 2 | ||||
-rw-r--r-- | Tutorial2/Scilab_code/Tutorial2_semilog.sce | 22 | ||||
-rw-r--r-- | Tutorial2/Scilab_code/Tutotial2_multi_plotting.sce | 35 | ||||
-rw-r--r-- | Tutorial2/Scilab_code/Tutotial2_plot_save.sce | 25 | ||||
-rw-r--r-- | Tutorial2/Scilab_code/Tutotial2_plotting.sce | 20 |
6 files changed, 103 insertions, 2 deletions
diff --git a/Tutorial1/Data/.~lock.Tut1_data2.csv# b/Tutorial1/Data/.~lock.Tut1_data2.csv# deleted file mode 100644 index 9856f47..0000000 --- a/Tutorial1/Data/.~lock.Tut1_data2.csv# +++ /dev/null @@ -1 +0,0 @@ -,chayan,Serendipity,27.09.2018 09:41,file:///home/chayan/.config/libreoffice/4;
\ No newline at end of file diff --git a/Tutorial1/Data/Tut1_data2.csv b/Tutorial2/Data/Tut2_data1.csv index 4b99c91..974af87 100644 --- a/Tutorial1/Data/Tut1_data2.csv +++ b/Tutorial2/Data/Tut2_data1.csv @@ -1,4 +1,4 @@ -order,time1,time2,time3,time4 +1,3.33333333333333E-05,3.33333333333333E-06,3.33333333333333E-06,0.0036866667 2,7.33333333333333E-05,0,3.33333333333333E-06,0.0038966667 3,2.33333333333333E-05,0,3.33333333333333E-06,0.00365 4,0.00003,0,6.66666666666667E-06,0.0036866667 diff --git a/Tutorial2/Scilab_code/Tutorial2_semilog.sce b/Tutorial2/Scilab_code/Tutorial2_semilog.sce new file mode 100644 index 0000000..57cb312 --- /dev/null +++ b/Tutorial2/Scilab_code/Tutorial2_semilog.sce @@ -0,0 +1,22 @@ +//This script demonstrate multi-plotting in Scilab +clear +clc + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2/Data/Tut2_data1.csv'); + +//Segregate the data into variables +y = Data(:,1); +x = [Data(:,4) Data(:,5)] + + +//Figure 1 is a semilog plot +fig1 = figure(); +plot2d(y,x,[1,2],logflag="nl") +legends(['Length of x1','Length of x3'],[1,2],opt="ur",font_size=1); + + +//Figure 2 is a loglog plot +fig2 = figure(); +plot2d(y,x,[3,-1],logflag="ll") +legends(['Length of x1','Length of x3'],[3,-1],opt="ur",font_size=1); diff --git a/Tutorial2/Scilab_code/Tutotial2_multi_plotting.sce b/Tutorial2/Scilab_code/Tutotial2_multi_plotting.sce new file mode 100644 index 0000000..91e4f20 --- /dev/null +++ b/Tutorial2/Scilab_code/Tutotial2_multi_plotting.sce @@ -0,0 +1,35 @@ +//This script demonstrate multi-plotting in Scilab +clear +clc + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2/Data/Tut2_data1.csv'); + +//Segregate the data into variables +y = Data(:,1); +x = [Data(:,2) Data(:,4)] + +//Fixing the range of plot +//Range is defined by [xmin,xmax,ymin,ymax] +range_of_plot = [-10,1e-05,20,10e-05] + +//Style of plot +//Stricly positive value represent the color +//Negative or zero value means given curve points are drawn using marks +//For color of marks use polyline property +style_plot = [-1,2] + +//Plotting y versus two data sets +plot2d(y,x,style_plot,rect=range_of_plot); + + +//For labelling axes and adding a title to the plot +xtitle('Plot of Time versus Length_x1 and Length_x3','Time','Length'); + + +//For legends "ur" for upper right +//legends(['Length of x1','Length of x3'],[-1,2]); //Default case +//legends(['Length of x1','Length of x3'],[-1,2],opt="ur"); //Position of the legend box +legends(['Length of x1','Length of x3'],[-1,2],opt="ur",font_size=2); //Font size of the legends + + diff --git a/Tutorial2/Scilab_code/Tutotial2_plot_save.sce b/Tutorial2/Scilab_code/Tutotial2_plot_save.sce new file mode 100644 index 0000000..baeecdc --- /dev/null +++ b/Tutorial2/Scilab_code/Tutotial2_plot_save.sce @@ -0,0 +1,25 @@ +//This script demonstrate exporting plots to svg/pdf files +clear +clc + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2/Data/Tut2_data1.csv'); + +//Segregate the data into variables +y = Data(:,1); +x1 = [Data(:,2) Data(:,4)] +x2 = [Data(:,3) Data(:,4)] + +//Figure 1 is y versus x1 +fig1 = figure(); +plot2d(y,x1); + +//Figure 2 is y versus x2 +fig2 = figure(); +plot2d(y,x2); + +//Export Figure 1 as svg file +xs2svg(fig1,'plot_y_versus_x1') + +//Export Figure 2 as pdf file +xs2pdf(fig2,'plot_y_versus_x2') diff --git a/Tutorial2/Scilab_code/Tutotial2_plotting.sce b/Tutorial2/Scilab_code/Tutotial2_plotting.sce new file mode 100644 index 0000000..4b0fe59 --- /dev/null +++ b/Tutorial2/Scilab_code/Tutotial2_plotting.sce @@ -0,0 +1,20 @@ +//This script demonstrate plotting in Scilab +clear +clc + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2/Data/Tut2_data1.csv'); + +//Segregate the data into variables +y = Data(:,1); +x1 = Data(:,2); +x2 = Data(:,3); +x3 = Data(:,4); +x4 = Data(:,5); + +//Plotting y versus x1 +plot(y,x1); + +//For labelling axes and adding a title to the plot +xtitle('Plot of y versus x1','Time','Length'); + |