From 6d39446c434cfcca02ae7a4551e2d66edf9def7f Mon Sep 17 00:00:00 2001 From: P Sunthar Date: Tue, 2 Oct 2018 00:09:14 +0530 Subject: Renamed dirs --- Tutorial01-Basics/Data/README.md | 1 + Tutorial01-Basics/Data/Tut1_data1.csv | 16 ++++ Tutorial01-Basics/Problems/README.md | 1 + Tutorial01-Basics/Problems/Tut1.pdf | Bin 0 -> 67566 bytes Tutorial01-Basics/README.md | 1 + Tutorial01-Basics/Scilab_code/README.md | 1 + .../Scilab_code/Tutorial1_Matrix_manipulation.sce | 105 +++++++++++++++++++++ .../Scilab_code/Tutorial1_function.sce | 27 ++++++ .../Scilab_code/Tutotial1_filehandling.sce | 23 +++++ Tutorial01-Basics/Scilab_code/mymean.sci | 9 ++ Tutorial01-Basics/Scilab_code/mystdev.sci | 8 ++ Tutorial02-Plots/Data/README.md | 1 + Tutorial02-Plots/Data/Tut2_data1.csv | 15 +++ Tutorial02-Plots/Problems/README.md | 1 + Tutorial02-Plots/Problems/Tut2.pdf | Bin 0 -> 29099 bytes Tutorial02-Plots/Problems/Tut2Problem.csv | 15 +++ Tutorial02-Plots/README.md | 1 + Tutorial02-Plots/Scilab_code/README.md | 1 + Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce | 28 ++++++ .../Scilab_code/Tutotial2_multi_plotting.sce | 38 ++++++++ .../Scilab_code/Tutotial2_plot_save.sce | 32 +++++++ .../Scilab_code/Tutotial2_plot_save_func.sce | 27 ++++++ .../Scilab_code/Tutotial2_plotting.sce | 16 ++++ .../Scilab_code/change_plot_attribs.sci | 10 ++ Tutorial03-Curve_fitting/Data/README.md | 1 + Tutorial03-Curve_fitting/Data/Tut3_Data.csv | 13 +++ Tutorial03-Curve_fitting/Problems/README.md | 1 + Tutorial03-Curve_fitting/Problems/Tut3.pdf | Bin 0 -> 43895 bytes Tutorial03-Curve_fitting/Problems/Tut3Problem.csv | 91 ++++++++++++++++++ Tutorial03-Curve_fitting/README.md | 1 + Tutorial03-Curve_fitting/Scilab_code/README.md | 1 + .../Scilab_code/Tutorial3_curve_fitting.sce | 33 +++++++ .../Tutorial3_curve_fitting_weighted.sce | 37 ++++++++ Tutorial03-Curve_fitting/Scilab_code/errorfun.sci | 4 + .../Scilab_code/errorfunweight.sci | 4 + .../Scilab_code/fit_function.sci | 6 ++ Tutorial04-ODE/Problems/README.md | 1 + Tutorial04-ODE/Problems/Tut4.pdf | Bin 0 -> 50507 bytes Tutorial04-ODE/README.md | 1 + Tutorial04-ODE/Scilab_code/README.md | 1 + .../Scilab_code/Tutorial4_ode_matrix.sce | 21 +++++ .../Scilab_code/Tutorial4_ode_simple.sce | 21 +++++ .../Scilab_code/Tutorial4_ode_simple_plot.sce | 26 +++++ .../Problems/README.md | 1 + Tutorial05-Solution_of_equations/Problems/Tut5.pdf | Bin 0 -> 64565 bytes Tutorial05-Solution_of_equations/README.md | 1 + .../Scilab_code/README.md | 1 + .../Scilab_code/Tutotial5_linear_equation.sce | 22 +++++ .../Scilab_code/Tutotial5_nonlinear_equation.sce | 21 +++++ .../Tutotial5_nonlinear_equation_twovar.sce | 17 ++++ .../Scilab_code/func.sci | 4 + .../Scilab_code/functwovar.sci | 6 ++ Tutorial1_Basic/Data/README.md | 1 - Tutorial1_Basic/Data/Tut1_data1.csv | 16 ---- Tutorial1_Basic/Data/Tut1_data3.csv | 1 - Tutorial1_Basic/Problems/README.md | 1 - Tutorial1_Basic/Problems/Tut1.pdf | Bin 67566 -> 0 bytes Tutorial1_Basic/README.md | 1 - Tutorial1_Basic/Scilab_code/README.md | 1 - .../Scilab_code/Tutorial1_Matrix_manipulation.sce | 105 --------------------- Tutorial1_Basic/Scilab_code/Tutorial1_function.sce | 27 ------ .../Scilab_code/Tutotial1_filehandling.sce | 23 ----- Tutorial1_Basic/Scilab_code/mymean.sci | 9 -- Tutorial1_Basic/Scilab_code/mystdev.sci | 8 -- Tutorial2_Plot/Data/README.md | 1 - Tutorial2_Plot/Data/Tut2_data1.csv | 15 --- Tutorial2_Plot/Problems/README.md | 1 - Tutorial2_Plot/Problems/Tut2.pdf | Bin 29099 -> 0 bytes Tutorial2_Plot/Problems/Tut2Problem.csv | 15 --- Tutorial2_Plot/README.md | 1 - Tutorial2_Plot/Scilab_code/README.md | 1 - Tutorial2_Plot/Scilab_code/Tutorial2_semilog.sce | 28 ------ .../Scilab_code/Tutotial2_multi_plotting.sce | 38 -------- Tutorial2_Plot/Scilab_code/Tutotial2_plot_save.sce | 32 ------- .../Scilab_code/Tutotial2_plot_save_func.sce | 27 ------ Tutorial2_Plot/Scilab_code/Tutotial2_plotting.sce | 16 ---- Tutorial2_Plot/Scilab_code/change_plot_attribs.sci | 10 -- Tutorial3_Curve_fitting/Data/README.md | 1 - Tutorial3_Curve_fitting/Data/Tut3_Data.csv | 13 --- Tutorial3_Curve_fitting/Problems/README.md | 1 - Tutorial3_Curve_fitting/Problems/Tut3.pdf | Bin 43895 -> 0 bytes Tutorial3_Curve_fitting/Problems/Tut3Problem.csv | 91 ------------------ Tutorial3_Curve_fitting/README.md | 1 - Tutorial3_Curve_fitting/Scilab_code/README.md | 1 - .../Scilab_code/Tutorial3_curve_fitting.sce | 33 ------- .../Tutorial3_curve_fitting_weighted.sce | 37 -------- Tutorial3_Curve_fitting/Scilab_code/errorfun.sci | 4 - .../Scilab_code/errorfunweight.sci | 4 - .../Scilab_code/fit_function.sci | 6 -- Tutorial4_ODE/Problems/README.md | 1 - Tutorial4_ODE/Problems/Tut4.pdf | Bin 50507 -> 0 bytes Tutorial4_ODE/README.md | 1 - Tutorial4_ODE/Scilab_code/README.md | 1 - Tutorial4_ODE/Scilab_code/Tutorial4_ode_matrix.sce | 21 ----- Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple.sce | 21 ----- .../Scilab_code/Tutorial4_ode_simple_plot.sce | 26 ----- Tutorial5_Solution_of_equations/Problems/README.md | 1 - Tutorial5_Solution_of_equations/Problems/Tut5.pdf | Bin 64565 -> 0 bytes Tutorial5_Solution_of_equations/README.md | 1 - .../Scilab_code/README.md | 1 - .../Scilab_code/Tutotial5_linear_equation.sce | 22 ----- .../Scilab_code/Tutotial5_nonlinear_equation.sce | 21 ----- .../Tutotial5_nonlinear_equation_twovar.sce | 17 ---- .../Scilab_code/func.sci | 4 - .../Scilab_code/functwovar.sci | 6 -- 105 files changed, 713 insertions(+), 714 deletions(-) create mode 100644 Tutorial01-Basics/Data/README.md create mode 100644 Tutorial01-Basics/Data/Tut1_data1.csv create mode 100644 Tutorial01-Basics/Problems/README.md create mode 100644 Tutorial01-Basics/Problems/Tut1.pdf create mode 100644 Tutorial01-Basics/README.md create mode 100644 Tutorial01-Basics/Scilab_code/README.md create mode 100644 Tutorial01-Basics/Scilab_code/Tutorial1_Matrix_manipulation.sce create mode 100644 Tutorial01-Basics/Scilab_code/Tutorial1_function.sce create mode 100644 Tutorial01-Basics/Scilab_code/Tutotial1_filehandling.sce create mode 100644 Tutorial01-Basics/Scilab_code/mymean.sci create mode 100644 Tutorial01-Basics/Scilab_code/mystdev.sci create mode 100644 Tutorial02-Plots/Data/README.md create mode 100644 Tutorial02-Plots/Data/Tut2_data1.csv create mode 100644 Tutorial02-Plots/Problems/README.md create mode 100644 Tutorial02-Plots/Problems/Tut2.pdf create mode 100644 Tutorial02-Plots/Problems/Tut2Problem.csv create mode 100644 Tutorial02-Plots/README.md create mode 100644 Tutorial02-Plots/Scilab_code/README.md create mode 100644 Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce create mode 100644 Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce create mode 100644 Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce create mode 100644 Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce create mode 100644 Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce create mode 100644 Tutorial02-Plots/Scilab_code/change_plot_attribs.sci create mode 100644 Tutorial03-Curve_fitting/Data/README.md create mode 100644 Tutorial03-Curve_fitting/Data/Tut3_Data.csv create mode 100644 Tutorial03-Curve_fitting/Problems/README.md create mode 100644 Tutorial03-Curve_fitting/Problems/Tut3.pdf create mode 100644 Tutorial03-Curve_fitting/Problems/Tut3Problem.csv create mode 100644 Tutorial03-Curve_fitting/README.md create mode 100644 Tutorial03-Curve_fitting/Scilab_code/README.md create mode 100644 Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce create mode 100644 Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce create mode 100644 Tutorial03-Curve_fitting/Scilab_code/errorfun.sci create mode 100644 Tutorial03-Curve_fitting/Scilab_code/errorfunweight.sci create mode 100644 Tutorial03-Curve_fitting/Scilab_code/fit_function.sci create mode 100644 Tutorial04-ODE/Problems/README.md create mode 100644 Tutorial04-ODE/Problems/Tut4.pdf create mode 100644 Tutorial04-ODE/README.md create mode 100644 Tutorial04-ODE/Scilab_code/README.md create mode 100644 Tutorial04-ODE/Scilab_code/Tutorial4_ode_matrix.sce create mode 100644 Tutorial04-ODE/Scilab_code/Tutorial4_ode_simple.sce create mode 100644 Tutorial04-ODE/Scilab_code/Tutorial4_ode_simple_plot.sce create mode 100644 Tutorial05-Solution_of_equations/Problems/README.md create mode 100644 Tutorial05-Solution_of_equations/Problems/Tut5.pdf create mode 100644 Tutorial05-Solution_of_equations/README.md create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/README.md create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/func.sci create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/functwovar.sci delete mode 100644 Tutorial1_Basic/Data/README.md delete mode 100644 Tutorial1_Basic/Data/Tut1_data1.csv delete mode 100644 Tutorial1_Basic/Data/Tut1_data3.csv delete mode 100644 Tutorial1_Basic/Problems/README.md delete mode 100644 Tutorial1_Basic/Problems/Tut1.pdf delete mode 100644 Tutorial1_Basic/README.md delete mode 100644 Tutorial1_Basic/Scilab_code/README.md delete mode 100644 Tutorial1_Basic/Scilab_code/Tutorial1_Matrix_manipulation.sce delete mode 100644 Tutorial1_Basic/Scilab_code/Tutorial1_function.sce delete mode 100644 Tutorial1_Basic/Scilab_code/Tutotial1_filehandling.sce delete mode 100644 Tutorial1_Basic/Scilab_code/mymean.sci delete mode 100644 Tutorial1_Basic/Scilab_code/mystdev.sci delete mode 100644 Tutorial2_Plot/Data/README.md delete mode 100644 Tutorial2_Plot/Data/Tut2_data1.csv delete mode 100644 Tutorial2_Plot/Problems/README.md delete mode 100644 Tutorial2_Plot/Problems/Tut2.pdf delete mode 100644 Tutorial2_Plot/Problems/Tut2Problem.csv delete mode 100644 Tutorial2_Plot/README.md delete mode 100644 Tutorial2_Plot/Scilab_code/README.md delete mode 100644 Tutorial2_Plot/Scilab_code/Tutorial2_semilog.sce delete mode 100644 Tutorial2_Plot/Scilab_code/Tutotial2_multi_plotting.sce delete mode 100644 Tutorial2_Plot/Scilab_code/Tutotial2_plot_save.sce delete mode 100644 Tutorial2_Plot/Scilab_code/Tutotial2_plot_save_func.sce delete mode 100644 Tutorial2_Plot/Scilab_code/Tutotial2_plotting.sce delete mode 100644 Tutorial2_Plot/Scilab_code/change_plot_attribs.sci delete mode 100644 Tutorial3_Curve_fitting/Data/README.md delete mode 100644 Tutorial3_Curve_fitting/Data/Tut3_Data.csv delete mode 100644 Tutorial3_Curve_fitting/Problems/README.md delete mode 100644 Tutorial3_Curve_fitting/Problems/Tut3.pdf delete mode 100644 Tutorial3_Curve_fitting/Problems/Tut3Problem.csv delete mode 100644 Tutorial3_Curve_fitting/README.md delete mode 100644 Tutorial3_Curve_fitting/Scilab_code/README.md delete mode 100644 Tutorial3_Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce delete mode 100644 Tutorial3_Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce delete mode 100644 Tutorial3_Curve_fitting/Scilab_code/errorfun.sci delete mode 100644 Tutorial3_Curve_fitting/Scilab_code/errorfunweight.sci delete mode 100644 Tutorial3_Curve_fitting/Scilab_code/fit_function.sci delete mode 100644 Tutorial4_ODE/Problems/README.md delete mode 100644 Tutorial4_ODE/Problems/Tut4.pdf delete mode 100644 Tutorial4_ODE/README.md delete mode 100644 Tutorial4_ODE/Scilab_code/README.md delete mode 100644 Tutorial4_ODE/Scilab_code/Tutorial4_ode_matrix.sce delete mode 100644 Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple.sce delete mode 100644 Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple_plot.sce delete mode 100644 Tutorial5_Solution_of_equations/Problems/README.md delete mode 100644 Tutorial5_Solution_of_equations/Problems/Tut5.pdf delete mode 100644 Tutorial5_Solution_of_equations/README.md delete mode 100644 Tutorial5_Solution_of_equations/Scilab_code/README.md delete mode 100644 Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce delete mode 100644 Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce delete mode 100644 Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce delete mode 100644 Tutorial5_Solution_of_equations/Scilab_code/func.sci delete mode 100644 Tutorial5_Solution_of_equations/Scilab_code/functwovar.sci diff --git a/Tutorial01-Basics/Data/README.md b/Tutorial01-Basics/Data/README.md new file mode 100644 index 0000000..7872997 --- /dev/null +++ b/Tutorial01-Basics/Data/README.md @@ -0,0 +1 @@ +# Data for matrix manipulation diff --git a/Tutorial01-Basics/Data/Tut1_data1.csv b/Tutorial01-Basics/Data/Tut1_data1.csv new file mode 100644 index 0000000..472523d --- /dev/null +++ b/Tutorial01-Basics/Data/Tut1_data1.csv @@ -0,0 +1,16 @@ +0.05077,0.0038966667 +0.02751,0.00365 +0.02075,0.0036866667 +0.01881,0.0037333333 +0.01938,0.0037933333 +0.08237,0.00385 +0.03718,0.0038766667 +0.03714,0.0041033333 +0.03657,0.0039433333 +0.0362,0.00392 +0.048,0.0040733333 +0.04172,0.0040966667 +0.04115,0.0042166667 +0.0435,0.00409 +0.04202,0.0362 +0.0487,0.04172 diff --git a/Tutorial01-Basics/Problems/README.md b/Tutorial01-Basics/Problems/README.md new file mode 100644 index 0000000..a7de39a --- /dev/null +++ b/Tutorial01-Basics/Problems/README.md @@ -0,0 +1 @@ +# Problems for matrix manipulation diff --git a/Tutorial01-Basics/Problems/Tut1.pdf b/Tutorial01-Basics/Problems/Tut1.pdf new file mode 100644 index 0000000..24abc4f Binary files /dev/null and b/Tutorial01-Basics/Problems/Tut1.pdf differ diff --git a/Tutorial01-Basics/README.md b/Tutorial01-Basics/README.md new file mode 100644 index 0000000..75af7cd --- /dev/null +++ b/Tutorial01-Basics/README.md @@ -0,0 +1 @@ +# Matrix manipulation diff --git a/Tutorial01-Basics/Scilab_code/README.md b/Tutorial01-Basics/Scilab_code/README.md new file mode 100644 index 0000000..275ce95 --- /dev/null +++ b/Tutorial01-Basics/Scilab_code/README.md @@ -0,0 +1 @@ +# Scilab code for matrix manipulation diff --git a/Tutorial01-Basics/Scilab_code/Tutorial1_Matrix_manipulation.sce b/Tutorial01-Basics/Scilab_code/Tutorial1_Matrix_manipulation.sce new file mode 100644 index 0000000..e4e06a6 --- /dev/null +++ b/Tutorial01-Basics/Scilab_code/Tutorial1_Matrix_manipulation.sce @@ -0,0 +1,105 @@ +//Script for Matrix manipulation tutorial +//This script gives a demonstration of a few basic matrix operations used in Scilab + +//Manual entry of matrices (A,B,x) +A = [1 2 3;3 2 1;2 4 5]; +B = [5 4 2;1 8 9;5 4 1]; +x = [1;2;3]; + +//Elementwise Matrix operations +//Summation of two matrices +Mat_Sum = A + B; +disp(Mat_Sum,'A+B'); + +//Subtraction of a matrix from another +Mat_Sub = A - B; +disp(Mat_Sub,'A-B'); + +//Elementwise multiplication of two matrices +Mat_element_product = A.*B; +disp(Mat_element_product,'A.*B'); + +//Elementwise square of a matrix +Mat_element_square = A.*A; +disp(Mat_element_square,'A.*A'); + +//Product of a scalar and matrix +Mat_scalar_product = 5*A; +disp(Mat_scalar_product,'5*A'); + +//Elementwise square-root of a matrix +Mat_sqrt = sqrt(A); +disp(Mat_sqrt,'sqrt(A)'); + +//Exponential of a matrix +Mat_exp = exp(A); +disp(Mat_exp,'exp(A)'); + + + +//Matrix operations +//Transpose of a matrix +Mat_trans = A'; +disp(Mat_trans,'Atranspose'); + +//Product of two matrices +Mat_product = A*B; +disp(Mat_product,'A*B'); + +//Product of a matrix and vector +Mat_vec_product = A*x; +disp(Mat_vec_product,'A*x'); + +//Square of a matrix +Mat_square = A*A; +disp(Mat_square,'A*A'); + +//Higher powers of a matrix +Mat_power_3 = A^3; +disp(Mat_power_3, 'A^3'); + +Mat_power_5 = A^5; +disp(Mat_power_5,'A^5'); + + +//Range and size of matrices +//Size of a matrix +size_of_matrix = size(A); + +//Row and column size of a vector/matrix +[row_size,column_size] = size(x); + +//Total number of elements in a matrix +total_elements = length(A); + +//To extract an element of A +Mat_element_31 = A(3,1); +disp(Mat_element_31,'3rd row, 1st col element of A'); + +//To extract a column of a matrix +Mat_second_column = A(:,2); +disp(Mat_second_column,'Second column of A'); + + +//To extract two columns of a matrix +Mat_first_two_column = A(:,1:2); +disp(Mat_first_two_column,'First two columns of A'); + +//To extract a row of a matrix +Mat_third_row = A(3,:); +disp(Mat_third_row,'Third row of A'); + + +//Construction of special matrices +//Identity matrix construction +Identity_3 = eye(3,3); +disp(Identity_3,'3 X 3 Identity matrix'); + +//Zero matrix construction +Zero_32 = zeros(3,2); +disp(Zero_32,'3 X 2 Zero matrix'); + +//All ones matrix +Ones_45 = ones(4,5); +disp(Ones_45,'4 X 5 all ones matrix'); + diff --git a/Tutorial01-Basics/Scilab_code/Tutorial1_function.sce b/Tutorial01-Basics/Scilab_code/Tutorial1_function.sce new file mode 100644 index 0000000..164430c --- /dev/null +++ b/Tutorial01-Basics/Scilab_code/Tutorial1_function.sce @@ -0,0 +1,27 @@ +//This Matlab script is used to compute mean and standard deviation of data + +//Clears all previous variables stored +clear + +//Clears screen +clc + + +//Executing the mymean function that computes the mean of a given data +exec mymean.sci; +//Executing the mystdev function that computes the standard deviation of a given data +exec mystdev.sci; + + +//Data for which the mean and standard-deviation is required +x = [1 2 5]; + +//Calling the mymean function. It takes data (a vector) as the input argument and returns mean of the data as output +mean_of_x = mymean(x); +disp(mean_of_x,'Mean of x'); + +//Calling the mystdev function. It takes data (a vector) and its mean as the input argument +//It returns standard deviation of the data as output +stddev_of_x = mystdev(x,mean_of_x); +disp(stddev_of_x,'Standard deviation of x'); + diff --git a/Tutorial01-Basics/Scilab_code/Tutotial1_filehandling.sce b/Tutorial01-Basics/Scilab_code/Tutotial1_filehandling.sce new file mode 100644 index 0000000..2924f03 --- /dev/null +++ b/Tutorial01-Basics/Scilab_code/Tutotial1_filehandling.sce @@ -0,0 +1,23 @@ +//This function is to import data from a csv file and store it in a variable +//Using the data mean and standard deviation of the data is computed +clear +clc + +exec mymean.sci; +exec mystdev.sci; + +//Import data from csv file +Data = csvRead('../Data/Tut1_data1.csv'); +x = Data(:,1); +y = Data(:,2); + + +//Compute mean of the imported data +mean_of_x = mymean(x); +//Compute standard deviation of the imported data +stdev_of_x= mystdev(x,mean_of_x); + +//Data to be exported (It can be a scalar, vector or matrix) +data_to_write = [mean_of_x stdev_of_x]; +//Export data to a csv file +csvWrite(data_to_write,'../Data/Tut1_data3.csv') diff --git a/Tutorial01-Basics/Scilab_code/mymean.sci b/Tutorial01-Basics/Scilab_code/mymean.sci new file mode 100644 index 0000000..6a96da4 --- /dev/null +++ b/Tutorial01-Basics/Scilab_code/mymean.sci @@ -0,0 +1,9 @@ +//Function to compute mean of a given data (a vector) + +function mean_of_data = mymean(data) + sum_of_data = 0; + for iteration = 1:1:length(data) + sum_of_data = data(iteration) + sum_of_data; + end + mean_of_data = sum_of_data/length(data); +endfunction diff --git a/Tutorial01-Basics/Scilab_code/mystdev.sci b/Tutorial01-Basics/Scilab_code/mystdev.sci new file mode 100644 index 0000000..53849a4 --- /dev/null +++ b/Tutorial01-Basics/Scilab_code/mystdev.sci @@ -0,0 +1,8 @@ +//A function to compute standard deviation of a given data +//Input: Data (a vector) and mean of the data as input +//Output: standard deviation of the data + +function standard_dev = mystdev(data,mean_of_data) + temp = (data - mean_of_data*ones(length(data)))^2; + standard_dev = sqrt(sum(temp)/(length(data)-1)); +endfunction diff --git a/Tutorial02-Plots/Data/README.md b/Tutorial02-Plots/Data/README.md new file mode 100644 index 0000000..a8e89e2 --- /dev/null +++ b/Tutorial02-Plots/Data/README.md @@ -0,0 +1 @@ +# Data for scientific plotting diff --git a/Tutorial02-Plots/Data/Tut2_data1.csv b/Tutorial02-Plots/Data/Tut2_data1.csv new file mode 100644 index 0000000..974af87 --- /dev/null +++ b/Tutorial02-Plots/Data/Tut2_data1.csv @@ -0,0 +1,15 @@ +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 +5,3.33333333333333E-05,0,3.33333333333333E-06,0.0037333333 +6,3.33333333333333E-05,0,3.33333333333333E-06,0.0037933333 +7,0.00004,0,3.33333333333333E-06,0.00385 +8,0.00004,3.33333333333333E-06,0.00001,0.0038766667 +9,0.00005,3.33333333333333E-06,3.33333333333333E-06,0.0041033333 +10,4.66666666666667E-05,0.00001,6.66666666666667E-06,0.0039433333 +11,0.00004,3.33333333333333E-06,6.66666666666667E-06,0.00392 +12,0.00005,0.00001,0.00001,0.0040733333 +13,5.66666666666667E-05,0.00001,0.00001,0.0040966667 +14,6.33333333333333E-05,6.66666666666667E-06,1.66666666666667E-05,0.0042166667 +15,5.66666666666667E-05,6.66666666666667E-06,0.00001,0.00409 diff --git a/Tutorial02-Plots/Problems/README.md b/Tutorial02-Plots/Problems/README.md new file mode 100644 index 0000000..5a77a1e --- /dev/null +++ b/Tutorial02-Plots/Problems/README.md @@ -0,0 +1 @@ +# Problems for scientific plotting diff --git a/Tutorial02-Plots/Problems/Tut2.pdf b/Tutorial02-Plots/Problems/Tut2.pdf new file mode 100644 index 0000000..ddc5da8 Binary files /dev/null and b/Tutorial02-Plots/Problems/Tut2.pdf differ diff --git a/Tutorial02-Plots/Problems/Tut2Problem.csv b/Tutorial02-Plots/Problems/Tut2Problem.csv new file mode 100644 index 0000000..53ce715 --- /dev/null +++ b/Tutorial02-Plots/Problems/Tut2Problem.csv @@ -0,0 +1,15 @@ +1,1.05E-14,1E-23,8.68735727748734E-16,3.06988472271084E-16 +2,1.05E-14,1E-23,8.68735727748734E-16,3.06988472271084E-16 +3,1.00E-14,3.70119513918373E-17,2.79736087695949E-15,2.80391266864912E-16 +4,3.70E-14,5.65E-14,1.04559200525073E-14,7.3865291428153E-16 +5,3.70E-14,1.4571218255213E-18,7.01651859869889E-15,8.11719142528036E-16 +6,1.00E-15,1.17015966442439E-18,7.7095815167149E-15,2.05292485680238E-13 +7,3.70E-15,3.80212541554568E-19,2.15320675526335E-14,1.19013817278563E-14 +8,3.70E-15,5.85059486105432E-20,1.54664178302948E-14,8.79191968097034E-13 +9,1.11E-14,3.76606511037024E-17,3.26447099775275E-14,7.32859431036281E-13 +10,3.70074341541719E-17,2.42958520611185E-19,3.81298644807883E-14,4.28588268926054E-12 +11,1E-23,1.78899096261478E-18,1.35509320162881E-13,1.01359319772089E-12 +12,1E-23,2.42863790449231E-19,1.71955664104378E-13,3.2126484715214E-13 +13,1.11022302462516E-16,1.68809380852638E-16,6.08815500389293E-13,7.94331887098062E-14 +14,1.11022302462516E-16,3.40508595605121E-16,3.84924467610673E-13,4.54796283179633E-15 +15,1.57009245868378E-16,3.78577179124018E-16,5.2850172570156E-13,1.20783040520019E-11 diff --git a/Tutorial02-Plots/README.md b/Tutorial02-Plots/README.md new file mode 100644 index 0000000..f99bc98 --- /dev/null +++ b/Tutorial02-Plots/README.md @@ -0,0 +1 @@ +# Scientific plotting diff --git a/Tutorial02-Plots/Scilab_code/README.md b/Tutorial02-Plots/Scilab_code/README.md new file mode 100644 index 0000000..150fc44 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/README.md @@ -0,0 +1 @@ +# Scilab code for scientific plotting diff --git a/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce b/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce new file mode 100644 index 0000000..9acc3a6 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce @@ -0,0 +1,28 @@ +//This script demonstrate multi-plotting in Scilab +clear +clc +exec change_plot_attribs.sci; + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +y = Data(:,1); +x = [Data(:,4) Data(:,5)] + +//Style of plot +style_plot = [1,2] + +//Figure 1 is a semilog plot +fig1 = scf(); +plot2d(y,x,[1,2],logflag="nl") +legends(['Length of x1','Length of x3'],style_plot,opt="ur",font_size=1); +change_plot_attribs('Time','Data','Sample semi-log plot',5,5,3) + + +//Figure 2 is a loglog plot +fig2 = scf(); +plot2d(y,x,style_plot,logflag="ll") +legends(['Length of x1','Length of x3'],style_plot,opt="ur",font_size=1); +change_plot_attribs('Time','Data','Figure2 (loglog)',5,5,3) + diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce new file mode 100644 index 0000000..ec5b193 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce @@ -0,0 +1,38 @@ +//This script demonstrates multi-plotting in Scilab +clear +clc +exec change_plot_attribs.sci; + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +t = Data(:,1); +x = [Data(:,2:4)] + +//Style of plot +style_plot = [1,2,4] + +//Fixing the range of plot +//Range is defined by [xmin,ymin,xmax,ymax] +range_of_plot = [1,-1e-5,15,8e-05]; + +//Plotting y versus two data sets +//plot2d(t,x,style_plot); +plot2d(t,x,style_plot,rect=range_of_plot); + +//Font size and labels for legends +//For legends "ur" for upper right +legends(['x1','x2', 'x3'],style_plot,opt="ur",font_size=2); + +//Call function to change plot attributes +change_plot_attribs('Time','Data','Data versus Time',5,5,3) + +//For thickness of the plots +attrib = gcf(); +attrib.children(2).children(1).children.thickness = 3; + + + + + diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce new file mode 100644 index 0000000..a3da8f3 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce @@ -0,0 +1,32 @@ +//This script demonstrate exporting plots to svg/pdf files +clear +clc + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +t = Data(:,1); +x = Data(:,2) + +//Ploting the figure. Name of the figure is fig1; +//Use the field Linewidth to specify thickness of the plot +fig1 = scf(1); +plot(t,x,'Linewidth',3); + +//Adding title, xlabels and ylabels +//Changing thickness and textsize in plot +attrib_axes = gca(); //Attributes of axes of active handle +attrib_axes.x_label.text = 'Time'; //X-label +attrib_axes.y_label.text = 'Data'; //Y-label +attrib_axes.title.text = 'x versus t'; //Title of the plot +attrib_axes.x_label.font_size = 5; //X_label font size +attrib_axes.y_label.font_size = 5; //Y_label font size +attrib_axes.title.font_size = 5; //Title font size +attrib_axes.font_size = 4; //Font size of x-axis and y-axis + +//Export Figure 1 as svg file +xs2svg(fig1,'plot_y_versus_x1'); + +//Export Figure 2 as pdf file +xs2pdf(fig1,'plot_y_versus_x1'); diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce new file mode 100644 index 0000000..d8f9963 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce @@ -0,0 +1,27 @@ +//This script demonstrate exporting plots to svg/pdf files +clear +clc + +exec change_plot_attribs.sci; + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +t = Data(:,1); +x = Data(:,2) + +//Ploting the figure. Name of the figure is fig1; +//Use the field Linewidth to specify thickness of the plot +fig1 = scf(1); +plot(t,x,'Linewidth',3); + +//Call function to change plot attributes +//Arguments (x_label,y_label,title,label_size,title_size,fontsize) +change_plot_attribs('Time','Data','x versus t',7,6,3) + +//Export Figure 1 as svg file +xs2svg(fig1,'plot_y_versus_x1'); + +//Export Figure 2 as pdf file +xs2pdf(fig1,'plot_y_versus_x1'); diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce new file mode 100644 index 0000000..5494863 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce @@ -0,0 +1,16 @@ +//This script demonstrate basic plot command in Scilab +clear +clc + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +t = Data(:,1); +x = Data(:,2); + +//Plotting x versus t +plot(t,x); + +xtitle('A x versus t plot','Time','Data') + diff --git a/Tutorial02-Plots/Scilab_code/change_plot_attribs.sci b/Tutorial02-Plots/Scilab_code/change_plot_attribs.sci new file mode 100644 index 0000000..68a04bd --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/change_plot_attribs.sci @@ -0,0 +1,10 @@ +function change_plot_attribs(xlab,ylab,caption,labelsize,capsize,fontsize) + attrib_axes = gca(); //Attributes of axes of active handle + attrib_axes.x_label.text = xlab; //X-label + attrib_axes.y_label.text = ylab; //Y-label + attrib_axes.title.text = caption; //Title of the plot + attrib_axes.x_label.font_size = labelsize; //X_label font size + attrib_axes.y_label.font_size = labelsize; //Y_label font size + attrib_axes.title.font_size = capsize; //Title font size + attrib_axes.font_size = fontsize; //Font size of x-axis and y-axis +endfunction diff --git a/Tutorial03-Curve_fitting/Data/README.md b/Tutorial03-Curve_fitting/Data/README.md new file mode 100644 index 0000000..7b5f1bd --- /dev/null +++ b/Tutorial03-Curve_fitting/Data/README.md @@ -0,0 +1 @@ +# Data for curve fitting diff --git a/Tutorial03-Curve_fitting/Data/Tut3_Data.csv b/Tutorial03-Curve_fitting/Data/Tut3_Data.csv new file mode 100644 index 0000000..fdaefcc --- /dev/null +++ b/Tutorial03-Curve_fitting/Data/Tut3_Data.csv @@ -0,0 +1,13 @@ +1,0.53916873238049445 +2,0.17798153799600328 +3,0.12207292040943035 +4,0.083177346548027525 +5,0.055253064762310761 +6,0.027227945666794384 +7,0.075642331036411825 +8,0.044912538844899041 +9,0.078845397608171469 +10,0.058759243199075772 +11,0.034198514001116481 +12,0.069646888441571811 +13,0.012750355494905292 diff --git a/Tutorial03-Curve_fitting/Problems/README.md b/Tutorial03-Curve_fitting/Problems/README.md new file mode 100644 index 0000000..565101b --- /dev/null +++ b/Tutorial03-Curve_fitting/Problems/README.md @@ -0,0 +1 @@ +# Problems for curve fitting diff --git a/Tutorial03-Curve_fitting/Problems/Tut3.pdf b/Tutorial03-Curve_fitting/Problems/Tut3.pdf new file mode 100644 index 0000000..c65c9e2 Binary files /dev/null and b/Tutorial03-Curve_fitting/Problems/Tut3.pdf differ diff --git a/Tutorial03-Curve_fitting/Problems/Tut3Problem.csv b/Tutorial03-Curve_fitting/Problems/Tut3Problem.csv new file mode 100644 index 0000000..6840862 --- /dev/null +++ b/Tutorial03-Curve_fitting/Problems/Tut3Problem.csv @@ -0,0 +1,91 @@ +1,1.6217170325525478 +1.1000000000000001,1.7361607926542162 +1.2,1.4886611048766012 +1.3,1.6095812042057687 +1.3999999999999999,1.3163168146419344 +1.5,1.330920700128845 +1.6000000000000001,1.110366283597638 +1.7000000000000002,0.81241353160410024 +1.8,0.753186814760053 +1.8999999999999999,0.69330057676696411 +2,0.49673930861054816 +2.1000000000000001,0.31269839670758381 +2.2000000000000002,0.20735326026520753 +2.2999999999999998,0.34251898976490369 +2.4000000000000004,0.017995492701055816 +2.5,0.15030667407027673 +2.6000000000000001,-0.10873060024156005 +2.7000000000000002,0.039912435622286677 +2.7999999999999998,-0.054524639195131827 +2.9000000000000004,-0.033821820189606222 +3,0.10912354497639255 +3.1000000000000001,0.050813981610711309 +3.2000000000000002,0.20889346610039716 +3.3000000000000003,0.35298948844971123 +3.4000000000000004,0.32474940318236023 +3.5,0.38239253826306385 +3.6000000000000001,0.32630838797473993 +3.7000000000000002,0.29718736751740976 +3.8000000000000003,0.19916162996035178 +3.9000000000000004,0.31696369945065445 +4,0.041190365415972992 +4.0999999999999996,0.11391228020475636 +4.2000000000000002,0.019485103395021075 +4.3000000000000007,-0.26342952196101571 +4.4000000000000004,-0.5092611472365397 +4.5,-0.41799215318123728 +4.5999999999999996,-0.73561485139026217 +4.7000000000000002,-0.92329619928696904 +4.8000000000000007,-0.90927651741448279 +4.9000000000000004,-1.1339614346763489 +5,-1.1517504631511968 +5.1000000000000005,-1.1402908029724872 +5.2000000000000002,-1.3521737597704713 +5.2999999999999998,-1.3520561465250629 +5.4000000000000004,-1.2713463645241503 +5.5,-1.1964088310952452 +5.6000000000000005,-1.2452944910422561 +5.7000000000000002,-1.169494079454507 +5.8000000000000007,-1.0070891198113012 +5.9000000000000004,-0.57833731612131689 +6,-0.37159339352530946 +6.1000000000000005,-0.13634550028140968 +6.2000000000000002,-0.18976896716746369 +6.3000000000000007,0.18023780009704649 +6.4000000000000004,0.48543592211567244 +6.5,0.6589373906769419 +6.6000000000000005,0.83333281190824393 +6.7000000000000002,0.96398998261249746 +6.8000000000000007,1.11701757929679 +6.9000000000000004,1.5186297452264101 +7,1.5889705955825626 +7.1000000000000005,1.6524294768055354 +7.2000000000000002,1.6839209146108967 +7.3000000000000007,1.6676039305248551 +7.4000000000000004,1.4677753919938958 +7.5,1.5943284226073355 +7.6000000000000005,1.3487063819931264 +7.7000000000000002,1.4916746989442995 +7.8000000000000007,1.3579050651588507 +7.9000000000000004,1.2201516339395857 +8,1.0354727508078239 +8.1000000000000014,0.87649138728423037 +8.1999999999999993,0.77387261855386325 +8.3000000000000007,0.4536800046194267 +8.4000000000000004,0.23974455070849177 +8.5,0.28174991982090863 +8.6000000000000014,0.17716212958380056 +8.6999999999999993,0.2300092768999859 +8.8000000000000007,-0.04592404352469065 +8.9000000000000004,0.021685712091274192 +9,0.11126106098973793 +9.0999999999999996,0.13994288990456027 +9.2000000000000011,-0.02788752686137759 +9.3000000000000007,0.0024405644345866159 +9.4000000000000004,0.03467349958429617 +9.5,0.062619838733266583 +9.5999999999999996,0.25690494810827541 +9.7000000000000011,0.17227340213228237 +9.8000000000000007,0.1249762313228136 +9.9000000000000004,0.22426593455377142 +10,0.22483299693724429 diff --git a/Tutorial03-Curve_fitting/README.md b/Tutorial03-Curve_fitting/README.md new file mode 100644 index 0000000..0b8b421 --- /dev/null +++ b/Tutorial03-Curve_fitting/README.md @@ -0,0 +1 @@ +# Curve fitting diff --git a/Tutorial03-Curve_fitting/Scilab_code/README.md b/Tutorial03-Curve_fitting/Scilab_code/README.md new file mode 100644 index 0000000..37230ff --- /dev/null +++ b/Tutorial03-Curve_fitting/Scilab_code/README.md @@ -0,0 +1 @@ +# Scilab code for curve fitting diff --git a/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce b/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce new file mode 100644 index 0000000..43e34db --- /dev/null +++ b/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce @@ -0,0 +1,33 @@ +//This function is for curve fitting using least-square + +clear +clc + +//The function to be fitted +exec fit_function.sci; +//The error function +exec errorfun.sci; + +//Read measured data +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial3_Curve_fitting/Data/Tut3_Data.csv') +//Time stamp +time = Data(:,1); +//Measured output +measured_data = Data(:,2); + +// initial parameters guess +initial_condition = [1 ; 1]; + +//Call least square function, +//Output is function value (func_value_xopt) at optimal coefficients (x_optimal)) +[func_value_xopt,coeff_optimal] = leastsq(list(errorfun,time,measured_data),initial_condition) + +error = errorfun(coeff_optimal,time,measured_data) +disp(error,'The error after least square approximation') + + +// Plot of measured data and fitted data versus time +fitted_data = fit_function(time, coeff_optimal); +plot2d(time, [measured_data,fitted_data], [-1,2]) +legend(["measure points", "fitted curve"],[-1,2],"ur"); +xtitle("a simple fit with leastsq","time","data") diff --git a/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce b/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce new file mode 100644 index 0000000..866a070 --- /dev/null +++ b/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce @@ -0,0 +1,37 @@ +//This function is for curve fitting using least-square + +clear +clc + +//The function to be fitted +exec fit_function.sci; +//The error function +exec errorfunweight.sci; + +//Read measured data +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial3_Curve_fitting/Data/Tut3_Data.csv') +//Time stamp +time = Data(:,1); +//Measured output +measured_data = Data(:,2); + +// weights for data fitting +weight_matrix = [1 1 1 1 1 1 5 5 5 5 5 5 5]'; + + +// minimize f(x) = sum_i weight_matrix(i)^2 (weight_matrix(tm(i),a,b) - measured_data(i))^2 +// initial parameters guess +initial_condition = [1 ; 1]; + +//f is the function value at optimal x (xopt) +[func_value_xopt,x_optimal] = leastsq(list(errorfunweight,time,measured_data,weight_matrix),initial_condition) + +error = errorfunweight(x_optimal,time,measured_data,weight_matrix) +disp(error,'The error after least square approximation') + + +// a small graphic +fitted_data = fit_function(time, x_optimal); +plot2d(time, [measured_data,fitted_data], [-1,2]) +legend(["measure points", "fitted curve"],[-1,2],"ur"); +xtitle("a simple fit with leastsq","time","data") diff --git a/Tutorial03-Curve_fitting/Scilab_code/errorfun.sci b/Tutorial03-Curve_fitting/Scilab_code/errorfun.sci new file mode 100644 index 0000000..741ad63 --- /dev/null +++ b/Tutorial03-Curve_fitting/Scilab_code/errorfun.sci @@ -0,0 +1,4 @@ +//A function to compute error between computed data and measured data +function err = errorfun(x, time, measured_data) + err = (fit_function(time, x) - measured_data ) +endfunction diff --git a/Tutorial03-Curve_fitting/Scilab_code/errorfunweight.sci b/Tutorial03-Curve_fitting/Scilab_code/errorfunweight.sci new file mode 100644 index 0000000..9326d91 --- /dev/null +++ b/Tutorial03-Curve_fitting/Scilab_code/errorfunweight.sci @@ -0,0 +1,4 @@ +//A function to compute error between computed data and measured data +function err = errorfunweight(x, time, measured_data, weight_matrix) + err = weight_matrix.*(fit_function(time, x) - measured_data ) +endfunction diff --git a/Tutorial03-Curve_fitting/Scilab_code/fit_function.sci b/Tutorial03-Curve_fitting/Scilab_code/fit_function.sci new file mode 100644 index 0000000..49240e8 --- /dev/null +++ b/Tutorial03-Curve_fitting/Scilab_code/fit_function.sci @@ -0,0 +1,6 @@ +//The function to be fitted in the measured data +function y = fit_function(t, x) + a = x(1); + b = x(2); + y = a./(1+b.*t.*t) +endfunction diff --git a/Tutorial04-ODE/Problems/README.md b/Tutorial04-ODE/Problems/README.md new file mode 100644 index 0000000..5ccbfe0 --- /dev/null +++ b/Tutorial04-ODE/Problems/README.md @@ -0,0 +1 @@ +# Problems for ODE diff --git a/Tutorial04-ODE/Problems/Tut4.pdf b/Tutorial04-ODE/Problems/Tut4.pdf new file mode 100644 index 0000000..2ad3662 Binary files /dev/null and b/Tutorial04-ODE/Problems/Tut4.pdf differ diff --git a/Tutorial04-ODE/README.md b/Tutorial04-ODE/README.md new file mode 100644 index 0000000..841c27b --- /dev/null +++ b/Tutorial04-ODE/README.md @@ -0,0 +1 @@ +# Ordinary differential equation diff --git a/Tutorial04-ODE/Scilab_code/README.md b/Tutorial04-ODE/Scilab_code/README.md new file mode 100644 index 0000000..78de9d2 --- /dev/null +++ b/Tutorial04-ODE/Scilab_code/README.md @@ -0,0 +1 @@ +# Scilab code for ODE diff --git a/Tutorial04-ODE/Scilab_code/Tutorial4_ode_matrix.sce b/Tutorial04-ODE/Scilab_code/Tutorial4_ode_matrix.sce new file mode 100644 index 0000000..33e5e33 --- /dev/null +++ b/Tutorial04-ODE/Scilab_code/Tutorial4_ode_matrix.sce @@ -0,0 +1,21 @@ +//This script demonstrates the use of ODE solver when matrix is involved +clear +clc + +//Definition of the function +function ydot = func(t,y) + ydot = A*y + ones(3,1); +endfunction + +//Defining the matrix +A = [1 2 1;9 6 1;1 3 4]; +//Initial condition +y0 = [-1;2;3]; +//Start time +t0= 0; +//The time at which the solution is computed +t = 0.2; +//Calling the ode solver +sol=ode(y0,t0,t,func); +//Displaying the solution +disp(sol,"y(t) at t = 0.2"); diff --git a/Tutorial04-ODE/Scilab_code/Tutorial4_ode_simple.sce b/Tutorial04-ODE/Scilab_code/Tutorial4_ode_simple.sce new file mode 100644 index 0000000..66431a4 --- /dev/null +++ b/Tutorial04-ODE/Scilab_code/Tutorial4_ode_simple.sce @@ -0,0 +1,21 @@ +//This script demonstrates the use of ODE solver +clear +clc + +//Definition the function. +//The function is dy/dt = cos(t)*sin(t) - tan(t) + 1 +function ydot = func(t,y) + ydot = t^2*exp(-2*t) + y +endfunction + +//Initial condition of the problem, a scalar or vector +y0 = -1; +//Initial time, a real scalar +t0= 0; +//The time at which the solution is computed +t = 0.2; +//Calling the ode solver +sol=ode(y0,t0,t,func); +//Displaying the solution +disp(sol,"y(t) at t = 0.2"); + diff --git a/Tutorial04-ODE/Scilab_code/Tutorial4_ode_simple_plot.sce b/Tutorial04-ODE/Scilab_code/Tutorial4_ode_simple_plot.sce new file mode 100644 index 0000000..f2df913 --- /dev/null +++ b/Tutorial04-ODE/Scilab_code/Tutorial4_ode_simple_plot.sce @@ -0,0 +1,26 @@ +//This script demonstrates the use of ODE solver and computing the +//solution at different times. The output is in the form of a plot +//of time versus computed solution +clear +clc + +//Definition the function. +function ydot = func(t,y) + ydot = t^2*exp(-2*t) + y +endfunction + +//Initial condition +y0 = -1; +//Start time +t0= 0; + +//The array of time where the solution is computed +tf = 4:0.01:10; + +//Calling the ODE solver +sol=ode(y0,t0,tf,func); + + +//Plotting the result +plot(tf,sol,'Linewidth',3) +xtitle('Dynamics of y','Time','y(t)') diff --git a/Tutorial05-Solution_of_equations/Problems/README.md b/Tutorial05-Solution_of_equations/Problems/README.md new file mode 100644 index 0000000..f7a9032 --- /dev/null +++ b/Tutorial05-Solution_of_equations/Problems/README.md @@ -0,0 +1 @@ +# Problems for non-linear equations diff --git a/Tutorial05-Solution_of_equations/Problems/Tut5.pdf b/Tutorial05-Solution_of_equations/Problems/Tut5.pdf new file mode 100644 index 0000000..a8c2c51 Binary files /dev/null and b/Tutorial05-Solution_of_equations/Problems/Tut5.pdf differ diff --git a/Tutorial05-Solution_of_equations/README.md b/Tutorial05-Solution_of_equations/README.md new file mode 100644 index 0000000..56a4129 --- /dev/null +++ b/Tutorial05-Solution_of_equations/README.md @@ -0,0 +1 @@ +# Non-linear equations diff --git a/Tutorial05-Solution_of_equations/Scilab_code/README.md b/Tutorial05-Solution_of_equations/Scilab_code/README.md new file mode 100644 index 0000000..297d7b8 --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/README.md @@ -0,0 +1 @@ +# Scilab code for non-linear equations diff --git a/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce new file mode 100644 index 0000000..dcd5510 --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce @@ -0,0 +1,22 @@ +//This scilab script is to compute the solution of a linear equation +clear +clc + +//Example of Ax + b = 0 where unique solution exists +A = [1 2 3;3 2 1;2 4 5]; +b = [7;7;12]; +[x,kerA] = linsolve(A,b); +disp(x,'Solution of Ax + b',kerA,'kernel of A'); + +//Example of Py+q = 0 where solution does not exist +P = [1 2 3;3 2 1;4 4 4] +q = [1;2;1] +[y,kerP] = linsolve(P,q); +disp(y,'Solution of Py + q',kerP,'kernel of P'); + +//Example of Lz+m = 0 where infinite solutions exist +L = [1 2 3;3 2 1;4 4 4] +m = [1;1;2] +[z,kerL] = linsolve(L,m); +disp(z,'Solution of Lz + m',kerL,'kernel of L'); + diff --git a/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce new file mode 100644 index 0000000..7f2a9ce --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce @@ -0,0 +1,21 @@ +//This scilab script is to compute the solution of a nonlinear function with initial +//guess x_0 +clear +clc + + +//The nonlinear equation for which solutions are sought +exec func.sci; + + +//Initial guess for the solution +t0 = 0; + +//Computation of solution using fsolve +y_result = fsolve(t0,func); +//Display the solution in command window +disp(y_result,'Solution of the equation') + + + + diff --git a/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce new file mode 100644 index 0000000..2b5dce1 --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce @@ -0,0 +1,17 @@ +//This scilab script is to compute the solution of a nonlinear function with initial +//guess x_0 +clear +clc + + +//The nonlinear equation for which solutions are sought +exec functwovar.sci; + + +//Initial guess for the solution +t0 = [0;0]; + +//Computation of solution using fsolve +y_result = fsolve(t0,functwovar); +//Display the solution in command window +disp(y_result,'Solution of the equation') diff --git a/Tutorial05-Solution_of_equations/Scilab_code/func.sci b/Tutorial05-Solution_of_equations/Scilab_code/func.sci new file mode 100644 index 0000000..013277d --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/func.sci @@ -0,0 +1,4 @@ +//This is script to define a fuction +function y = func(t) + y = cos(t)*sin(t) - tan(t) + 1 +endfunction diff --git a/Tutorial05-Solution_of_equations/Scilab_code/functwovar.sci b/Tutorial05-Solution_of_equations/Scilab_code/functwovar.sci new file mode 100644 index 0000000..6506ce4 --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/functwovar.sci @@ -0,0 +1,6 @@ +//This is script to define a fuction +function y = functwovar(t) + x = t(1); + z = t(2); + y = [x^2+z^2-1;x^2*exp(-2*x) + z] +endfunction diff --git a/Tutorial1_Basic/Data/README.md b/Tutorial1_Basic/Data/README.md deleted file mode 100644 index 7872997..0000000 --- a/Tutorial1_Basic/Data/README.md +++ /dev/null @@ -1 +0,0 @@ -# Data for matrix manipulation diff --git a/Tutorial1_Basic/Data/Tut1_data1.csv b/Tutorial1_Basic/Data/Tut1_data1.csv deleted file mode 100644 index 472523d..0000000 --- a/Tutorial1_Basic/Data/Tut1_data1.csv +++ /dev/null @@ -1,16 +0,0 @@ -0.05077,0.0038966667 -0.02751,0.00365 -0.02075,0.0036866667 -0.01881,0.0037333333 -0.01938,0.0037933333 -0.08237,0.00385 -0.03718,0.0038766667 -0.03714,0.0041033333 -0.03657,0.0039433333 -0.0362,0.00392 -0.048,0.0040733333 -0.04172,0.0040966667 -0.04115,0.0042166667 -0.0435,0.00409 -0.04202,0.0362 -0.0487,0.04172 diff --git a/Tutorial1_Basic/Data/Tut1_data3.csv b/Tutorial1_Basic/Data/Tut1_data3.csv deleted file mode 100644 index b8a1e42..0000000 --- a/Tutorial1_Basic/Data/Tut1_data3.csv +++ /dev/null @@ -1 +0,0 @@ -0.039485624999999996,0.015297881756962301 diff --git a/Tutorial1_Basic/Problems/README.md b/Tutorial1_Basic/Problems/README.md deleted file mode 100644 index a7de39a..0000000 --- a/Tutorial1_Basic/Problems/README.md +++ /dev/null @@ -1 +0,0 @@ -# Problems for matrix manipulation diff --git a/Tutorial1_Basic/Problems/Tut1.pdf b/Tutorial1_Basic/Problems/Tut1.pdf deleted file mode 100644 index 24abc4f..0000000 Binary files a/Tutorial1_Basic/Problems/Tut1.pdf and /dev/null differ diff --git a/Tutorial1_Basic/README.md b/Tutorial1_Basic/README.md deleted file mode 100644 index 75af7cd..0000000 --- a/Tutorial1_Basic/README.md +++ /dev/null @@ -1 +0,0 @@ -# Matrix manipulation diff --git a/Tutorial1_Basic/Scilab_code/README.md b/Tutorial1_Basic/Scilab_code/README.md deleted file mode 100644 index 275ce95..0000000 --- a/Tutorial1_Basic/Scilab_code/README.md +++ /dev/null @@ -1 +0,0 @@ -# Scilab code for matrix manipulation diff --git a/Tutorial1_Basic/Scilab_code/Tutorial1_Matrix_manipulation.sce b/Tutorial1_Basic/Scilab_code/Tutorial1_Matrix_manipulation.sce deleted file mode 100644 index e4e06a6..0000000 --- a/Tutorial1_Basic/Scilab_code/Tutorial1_Matrix_manipulation.sce +++ /dev/null @@ -1,105 +0,0 @@ -//Script for Matrix manipulation tutorial -//This script gives a demonstration of a few basic matrix operations used in Scilab - -//Manual entry of matrices (A,B,x) -A = [1 2 3;3 2 1;2 4 5]; -B = [5 4 2;1 8 9;5 4 1]; -x = [1;2;3]; - -//Elementwise Matrix operations -//Summation of two matrices -Mat_Sum = A + B; -disp(Mat_Sum,'A+B'); - -//Subtraction of a matrix from another -Mat_Sub = A - B; -disp(Mat_Sub,'A-B'); - -//Elementwise multiplication of two matrices -Mat_element_product = A.*B; -disp(Mat_element_product,'A.*B'); - -//Elementwise square of a matrix -Mat_element_square = A.*A; -disp(Mat_element_square,'A.*A'); - -//Product of a scalar and matrix -Mat_scalar_product = 5*A; -disp(Mat_scalar_product,'5*A'); - -//Elementwise square-root of a matrix -Mat_sqrt = sqrt(A); -disp(Mat_sqrt,'sqrt(A)'); - -//Exponential of a matrix -Mat_exp = exp(A); -disp(Mat_exp,'exp(A)'); - - - -//Matrix operations -//Transpose of a matrix -Mat_trans = A'; -disp(Mat_trans,'Atranspose'); - -//Product of two matrices -Mat_product = A*B; -disp(Mat_product,'A*B'); - -//Product of a matrix and vector -Mat_vec_product = A*x; -disp(Mat_vec_product,'A*x'); - -//Square of a matrix -Mat_square = A*A; -disp(Mat_square,'A*A'); - -//Higher powers of a matrix -Mat_power_3 = A^3; -disp(Mat_power_3, 'A^3'); - -Mat_power_5 = A^5; -disp(Mat_power_5,'A^5'); - - -//Range and size of matrices -//Size of a matrix -size_of_matrix = size(A); - -//Row and column size of a vector/matrix -[row_size,column_size] = size(x); - -//Total number of elements in a matrix -total_elements = length(A); - -//To extract an element of A -Mat_element_31 = A(3,1); -disp(Mat_element_31,'3rd row, 1st col element of A'); - -//To extract a column of a matrix -Mat_second_column = A(:,2); -disp(Mat_second_column,'Second column of A'); - - -//To extract two columns of a matrix -Mat_first_two_column = A(:,1:2); -disp(Mat_first_two_column,'First two columns of A'); - -//To extract a row of a matrix -Mat_third_row = A(3,:); -disp(Mat_third_row,'Third row of A'); - - -//Construction of special matrices -//Identity matrix construction -Identity_3 = eye(3,3); -disp(Identity_3,'3 X 3 Identity matrix'); - -//Zero matrix construction -Zero_32 = zeros(3,2); -disp(Zero_32,'3 X 2 Zero matrix'); - -//All ones matrix -Ones_45 = ones(4,5); -disp(Ones_45,'4 X 5 all ones matrix'); - diff --git a/Tutorial1_Basic/Scilab_code/Tutorial1_function.sce b/Tutorial1_Basic/Scilab_code/Tutorial1_function.sce deleted file mode 100644 index 164430c..0000000 --- a/Tutorial1_Basic/Scilab_code/Tutorial1_function.sce +++ /dev/null @@ -1,27 +0,0 @@ -//This Matlab script is used to compute mean and standard deviation of data - -//Clears all previous variables stored -clear - -//Clears screen -clc - - -//Executing the mymean function that computes the mean of a given data -exec mymean.sci; -//Executing the mystdev function that computes the standard deviation of a given data -exec mystdev.sci; - - -//Data for which the mean and standard-deviation is required -x = [1 2 5]; - -//Calling the mymean function. It takes data (a vector) as the input argument and returns mean of the data as output -mean_of_x = mymean(x); -disp(mean_of_x,'Mean of x'); - -//Calling the mystdev function. It takes data (a vector) and its mean as the input argument -//It returns standard deviation of the data as output -stddev_of_x = mystdev(x,mean_of_x); -disp(stddev_of_x,'Standard deviation of x'); - diff --git a/Tutorial1_Basic/Scilab_code/Tutotial1_filehandling.sce b/Tutorial1_Basic/Scilab_code/Tutotial1_filehandling.sce deleted file mode 100644 index 2924f03..0000000 --- a/Tutorial1_Basic/Scilab_code/Tutotial1_filehandling.sce +++ /dev/null @@ -1,23 +0,0 @@ -//This function is to import data from a csv file and store it in a variable -//Using the data mean and standard deviation of the data is computed -clear -clc - -exec mymean.sci; -exec mystdev.sci; - -//Import data from csv file -Data = csvRead('../Data/Tut1_data1.csv'); -x = Data(:,1); -y = Data(:,2); - - -//Compute mean of the imported data -mean_of_x = mymean(x); -//Compute standard deviation of the imported data -stdev_of_x= mystdev(x,mean_of_x); - -//Data to be exported (It can be a scalar, vector or matrix) -data_to_write = [mean_of_x stdev_of_x]; -//Export data to a csv file -csvWrite(data_to_write,'../Data/Tut1_data3.csv') diff --git a/Tutorial1_Basic/Scilab_code/mymean.sci b/Tutorial1_Basic/Scilab_code/mymean.sci deleted file mode 100644 index 6a96da4..0000000 --- a/Tutorial1_Basic/Scilab_code/mymean.sci +++ /dev/null @@ -1,9 +0,0 @@ -//Function to compute mean of a given data (a vector) - -function mean_of_data = mymean(data) - sum_of_data = 0; - for iteration = 1:1:length(data) - sum_of_data = data(iteration) + sum_of_data; - end - mean_of_data = sum_of_data/length(data); -endfunction diff --git a/Tutorial1_Basic/Scilab_code/mystdev.sci b/Tutorial1_Basic/Scilab_code/mystdev.sci deleted file mode 100644 index 53849a4..0000000 --- a/Tutorial1_Basic/Scilab_code/mystdev.sci +++ /dev/null @@ -1,8 +0,0 @@ -//A function to compute standard deviation of a given data -//Input: Data (a vector) and mean of the data as input -//Output: standard deviation of the data - -function standard_dev = mystdev(data,mean_of_data) - temp = (data - mean_of_data*ones(length(data)))^2; - standard_dev = sqrt(sum(temp)/(length(data)-1)); -endfunction diff --git a/Tutorial2_Plot/Data/README.md b/Tutorial2_Plot/Data/README.md deleted file mode 100644 index a8e89e2..0000000 --- a/Tutorial2_Plot/Data/README.md +++ /dev/null @@ -1 +0,0 @@ -# Data for scientific plotting diff --git a/Tutorial2_Plot/Data/Tut2_data1.csv b/Tutorial2_Plot/Data/Tut2_data1.csv deleted file mode 100644 index 974af87..0000000 --- a/Tutorial2_Plot/Data/Tut2_data1.csv +++ /dev/null @@ -1,15 +0,0 @@ -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 -5,3.33333333333333E-05,0,3.33333333333333E-06,0.0037333333 -6,3.33333333333333E-05,0,3.33333333333333E-06,0.0037933333 -7,0.00004,0,3.33333333333333E-06,0.00385 -8,0.00004,3.33333333333333E-06,0.00001,0.0038766667 -9,0.00005,3.33333333333333E-06,3.33333333333333E-06,0.0041033333 -10,4.66666666666667E-05,0.00001,6.66666666666667E-06,0.0039433333 -11,0.00004,3.33333333333333E-06,6.66666666666667E-06,0.00392 -12,0.00005,0.00001,0.00001,0.0040733333 -13,5.66666666666667E-05,0.00001,0.00001,0.0040966667 -14,6.33333333333333E-05,6.66666666666667E-06,1.66666666666667E-05,0.0042166667 -15,5.66666666666667E-05,6.66666666666667E-06,0.00001,0.00409 diff --git a/Tutorial2_Plot/Problems/README.md b/Tutorial2_Plot/Problems/README.md deleted file mode 100644 index 5a77a1e..0000000 --- a/Tutorial2_Plot/Problems/README.md +++ /dev/null @@ -1 +0,0 @@ -# Problems for scientific plotting diff --git a/Tutorial2_Plot/Problems/Tut2.pdf b/Tutorial2_Plot/Problems/Tut2.pdf deleted file mode 100644 index ddc5da8..0000000 Binary files a/Tutorial2_Plot/Problems/Tut2.pdf and /dev/null differ diff --git a/Tutorial2_Plot/Problems/Tut2Problem.csv b/Tutorial2_Plot/Problems/Tut2Problem.csv deleted file mode 100644 index 53ce715..0000000 --- a/Tutorial2_Plot/Problems/Tut2Problem.csv +++ /dev/null @@ -1,15 +0,0 @@ -1,1.05E-14,1E-23,8.68735727748734E-16,3.06988472271084E-16 -2,1.05E-14,1E-23,8.68735727748734E-16,3.06988472271084E-16 -3,1.00E-14,3.70119513918373E-17,2.79736087695949E-15,2.80391266864912E-16 -4,3.70E-14,5.65E-14,1.04559200525073E-14,7.3865291428153E-16 -5,3.70E-14,1.4571218255213E-18,7.01651859869889E-15,8.11719142528036E-16 -6,1.00E-15,1.17015966442439E-18,7.7095815167149E-15,2.05292485680238E-13 -7,3.70E-15,3.80212541554568E-19,2.15320675526335E-14,1.19013817278563E-14 -8,3.70E-15,5.85059486105432E-20,1.54664178302948E-14,8.79191968097034E-13 -9,1.11E-14,3.76606511037024E-17,3.26447099775275E-14,7.32859431036281E-13 -10,3.70074341541719E-17,2.42958520611185E-19,3.81298644807883E-14,4.28588268926054E-12 -11,1E-23,1.78899096261478E-18,1.35509320162881E-13,1.01359319772089E-12 -12,1E-23,2.42863790449231E-19,1.71955664104378E-13,3.2126484715214E-13 -13,1.11022302462516E-16,1.68809380852638E-16,6.08815500389293E-13,7.94331887098062E-14 -14,1.11022302462516E-16,3.40508595605121E-16,3.84924467610673E-13,4.54796283179633E-15 -15,1.57009245868378E-16,3.78577179124018E-16,5.2850172570156E-13,1.20783040520019E-11 diff --git a/Tutorial2_Plot/README.md b/Tutorial2_Plot/README.md deleted file mode 100644 index f99bc98..0000000 --- a/Tutorial2_Plot/README.md +++ /dev/null @@ -1 +0,0 @@ -# Scientific plotting diff --git a/Tutorial2_Plot/Scilab_code/README.md b/Tutorial2_Plot/Scilab_code/README.md deleted file mode 100644 index 150fc44..0000000 --- a/Tutorial2_Plot/Scilab_code/README.md +++ /dev/null @@ -1 +0,0 @@ -# Scilab code for scientific plotting diff --git a/Tutorial2_Plot/Scilab_code/Tutorial2_semilog.sce b/Tutorial2_Plot/Scilab_code/Tutorial2_semilog.sce deleted file mode 100644 index 9acc3a6..0000000 --- a/Tutorial2_Plot/Scilab_code/Tutorial2_semilog.sce +++ /dev/null @@ -1,28 +0,0 @@ -//This script demonstrate multi-plotting in Scilab -clear -clc -exec change_plot_attribs.sci; - -//Import data from file -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); - -//Segregate the data into variables -y = Data(:,1); -x = [Data(:,4) Data(:,5)] - -//Style of plot -style_plot = [1,2] - -//Figure 1 is a semilog plot -fig1 = scf(); -plot2d(y,x,[1,2],logflag="nl") -legends(['Length of x1','Length of x3'],style_plot,opt="ur",font_size=1); -change_plot_attribs('Time','Data','Sample semi-log plot',5,5,3) - - -//Figure 2 is a loglog plot -fig2 = scf(); -plot2d(y,x,style_plot,logflag="ll") -legends(['Length of x1','Length of x3'],style_plot,opt="ur",font_size=1); -change_plot_attribs('Time','Data','Figure2 (loglog)',5,5,3) - diff --git a/Tutorial2_Plot/Scilab_code/Tutotial2_multi_plotting.sce b/Tutorial2_Plot/Scilab_code/Tutotial2_multi_plotting.sce deleted file mode 100644 index ec5b193..0000000 --- a/Tutorial2_Plot/Scilab_code/Tutotial2_multi_plotting.sce +++ /dev/null @@ -1,38 +0,0 @@ -//This script demonstrates multi-plotting in Scilab -clear -clc -exec change_plot_attribs.sci; - -//Import data from file -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); - -//Segregate the data into variables -t = Data(:,1); -x = [Data(:,2:4)] - -//Style of plot -style_plot = [1,2,4] - -//Fixing the range of plot -//Range is defined by [xmin,ymin,xmax,ymax] -range_of_plot = [1,-1e-5,15,8e-05]; - -//Plotting y versus two data sets -//plot2d(t,x,style_plot); -plot2d(t,x,style_plot,rect=range_of_plot); - -//Font size and labels for legends -//For legends "ur" for upper right -legends(['x1','x2', 'x3'],style_plot,opt="ur",font_size=2); - -//Call function to change plot attributes -change_plot_attribs('Time','Data','Data versus Time',5,5,3) - -//For thickness of the plots -attrib = gcf(); -attrib.children(2).children(1).children.thickness = 3; - - - - - diff --git a/Tutorial2_Plot/Scilab_code/Tutotial2_plot_save.sce b/Tutorial2_Plot/Scilab_code/Tutotial2_plot_save.sce deleted file mode 100644 index a3da8f3..0000000 --- a/Tutorial2_Plot/Scilab_code/Tutotial2_plot_save.sce +++ /dev/null @@ -1,32 +0,0 @@ -//This script demonstrate exporting plots to svg/pdf files -clear -clc - -//Import data from file -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); - -//Segregate the data into variables -t = Data(:,1); -x = Data(:,2) - -//Ploting the figure. Name of the figure is fig1; -//Use the field Linewidth to specify thickness of the plot -fig1 = scf(1); -plot(t,x,'Linewidth',3); - -//Adding title, xlabels and ylabels -//Changing thickness and textsize in plot -attrib_axes = gca(); //Attributes of axes of active handle -attrib_axes.x_label.text = 'Time'; //X-label -attrib_axes.y_label.text = 'Data'; //Y-label -attrib_axes.title.text = 'x versus t'; //Title of the plot -attrib_axes.x_label.font_size = 5; //X_label font size -attrib_axes.y_label.font_size = 5; //Y_label font size -attrib_axes.title.font_size = 5; //Title font size -attrib_axes.font_size = 4; //Font size of x-axis and y-axis - -//Export Figure 1 as svg file -xs2svg(fig1,'plot_y_versus_x1'); - -//Export Figure 2 as pdf file -xs2pdf(fig1,'plot_y_versus_x1'); diff --git a/Tutorial2_Plot/Scilab_code/Tutotial2_plot_save_func.sce b/Tutorial2_Plot/Scilab_code/Tutotial2_plot_save_func.sce deleted file mode 100644 index d8f9963..0000000 --- a/Tutorial2_Plot/Scilab_code/Tutotial2_plot_save_func.sce +++ /dev/null @@ -1,27 +0,0 @@ -//This script demonstrate exporting plots to svg/pdf files -clear -clc - -exec change_plot_attribs.sci; - -//Import data from file -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); - -//Segregate the data into variables -t = Data(:,1); -x = Data(:,2) - -//Ploting the figure. Name of the figure is fig1; -//Use the field Linewidth to specify thickness of the plot -fig1 = scf(1); -plot(t,x,'Linewidth',3); - -//Call function to change plot attributes -//Arguments (x_label,y_label,title,label_size,title_size,fontsize) -change_plot_attribs('Time','Data','x versus t',7,6,3) - -//Export Figure 1 as svg file -xs2svg(fig1,'plot_y_versus_x1'); - -//Export Figure 2 as pdf file -xs2pdf(fig1,'plot_y_versus_x1'); diff --git a/Tutorial2_Plot/Scilab_code/Tutotial2_plotting.sce b/Tutorial2_Plot/Scilab_code/Tutotial2_plotting.sce deleted file mode 100644 index 5494863..0000000 --- a/Tutorial2_Plot/Scilab_code/Tutotial2_plotting.sce +++ /dev/null @@ -1,16 +0,0 @@ -//This script demonstrate basic plot command in Scilab -clear -clc - -//Import data from file -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); - -//Segregate the data into variables -t = Data(:,1); -x = Data(:,2); - -//Plotting x versus t -plot(t,x); - -xtitle('A x versus t plot','Time','Data') - diff --git a/Tutorial2_Plot/Scilab_code/change_plot_attribs.sci b/Tutorial2_Plot/Scilab_code/change_plot_attribs.sci deleted file mode 100644 index 68a04bd..0000000 --- a/Tutorial2_Plot/Scilab_code/change_plot_attribs.sci +++ /dev/null @@ -1,10 +0,0 @@ -function change_plot_attribs(xlab,ylab,caption,labelsize,capsize,fontsize) - attrib_axes = gca(); //Attributes of axes of active handle - attrib_axes.x_label.text = xlab; //X-label - attrib_axes.y_label.text = ylab; //Y-label - attrib_axes.title.text = caption; //Title of the plot - attrib_axes.x_label.font_size = labelsize; //X_label font size - attrib_axes.y_label.font_size = labelsize; //Y_label font size - attrib_axes.title.font_size = capsize; //Title font size - attrib_axes.font_size = fontsize; //Font size of x-axis and y-axis -endfunction diff --git a/Tutorial3_Curve_fitting/Data/README.md b/Tutorial3_Curve_fitting/Data/README.md deleted file mode 100644 index 7b5f1bd..0000000 --- a/Tutorial3_Curve_fitting/Data/README.md +++ /dev/null @@ -1 +0,0 @@ -# Data for curve fitting diff --git a/Tutorial3_Curve_fitting/Data/Tut3_Data.csv b/Tutorial3_Curve_fitting/Data/Tut3_Data.csv deleted file mode 100644 index fdaefcc..0000000 --- a/Tutorial3_Curve_fitting/Data/Tut3_Data.csv +++ /dev/null @@ -1,13 +0,0 @@ -1,0.53916873238049445 -2,0.17798153799600328 -3,0.12207292040943035 -4,0.083177346548027525 -5,0.055253064762310761 -6,0.027227945666794384 -7,0.075642331036411825 -8,0.044912538844899041 -9,0.078845397608171469 -10,0.058759243199075772 -11,0.034198514001116481 -12,0.069646888441571811 -13,0.012750355494905292 diff --git a/Tutorial3_Curve_fitting/Problems/README.md b/Tutorial3_Curve_fitting/Problems/README.md deleted file mode 100644 index 565101b..0000000 --- a/Tutorial3_Curve_fitting/Problems/README.md +++ /dev/null @@ -1 +0,0 @@ -# Problems for curve fitting diff --git a/Tutorial3_Curve_fitting/Problems/Tut3.pdf b/Tutorial3_Curve_fitting/Problems/Tut3.pdf deleted file mode 100644 index c65c9e2..0000000 Binary files a/Tutorial3_Curve_fitting/Problems/Tut3.pdf and /dev/null differ diff --git a/Tutorial3_Curve_fitting/Problems/Tut3Problem.csv b/Tutorial3_Curve_fitting/Problems/Tut3Problem.csv deleted file mode 100644 index 6840862..0000000 --- a/Tutorial3_Curve_fitting/Problems/Tut3Problem.csv +++ /dev/null @@ -1,91 +0,0 @@ -1,1.6217170325525478 -1.1000000000000001,1.7361607926542162 -1.2,1.4886611048766012 -1.3,1.6095812042057687 -1.3999999999999999,1.3163168146419344 -1.5,1.330920700128845 -1.6000000000000001,1.110366283597638 -1.7000000000000002,0.81241353160410024 -1.8,0.753186814760053 -1.8999999999999999,0.69330057676696411 -2,0.49673930861054816 -2.1000000000000001,0.31269839670758381 -2.2000000000000002,0.20735326026520753 -2.2999999999999998,0.34251898976490369 -2.4000000000000004,0.017995492701055816 -2.5,0.15030667407027673 -2.6000000000000001,-0.10873060024156005 -2.7000000000000002,0.039912435622286677 -2.7999999999999998,-0.054524639195131827 -2.9000000000000004,-0.033821820189606222 -3,0.10912354497639255 -3.1000000000000001,0.050813981610711309 -3.2000000000000002,0.20889346610039716 -3.3000000000000003,0.35298948844971123 -3.4000000000000004,0.32474940318236023 -3.5,0.38239253826306385 -3.6000000000000001,0.32630838797473993 -3.7000000000000002,0.29718736751740976 -3.8000000000000003,0.19916162996035178 -3.9000000000000004,0.31696369945065445 -4,0.041190365415972992 -4.0999999999999996,0.11391228020475636 -4.2000000000000002,0.019485103395021075 -4.3000000000000007,-0.26342952196101571 -4.4000000000000004,-0.5092611472365397 -4.5,-0.41799215318123728 -4.5999999999999996,-0.73561485139026217 -4.7000000000000002,-0.92329619928696904 -4.8000000000000007,-0.90927651741448279 -4.9000000000000004,-1.1339614346763489 -5,-1.1517504631511968 -5.1000000000000005,-1.1402908029724872 -5.2000000000000002,-1.3521737597704713 -5.2999999999999998,-1.3520561465250629 -5.4000000000000004,-1.2713463645241503 -5.5,-1.1964088310952452 -5.6000000000000005,-1.2452944910422561 -5.7000000000000002,-1.169494079454507 -5.8000000000000007,-1.0070891198113012 -5.9000000000000004,-0.57833731612131689 -6,-0.37159339352530946 -6.1000000000000005,-0.13634550028140968 -6.2000000000000002,-0.18976896716746369 -6.3000000000000007,0.18023780009704649 -6.4000000000000004,0.48543592211567244 -6.5,0.6589373906769419 -6.6000000000000005,0.83333281190824393 -6.7000000000000002,0.96398998261249746 -6.8000000000000007,1.11701757929679 -6.9000000000000004,1.5186297452264101 -7,1.5889705955825626 -7.1000000000000005,1.6524294768055354 -7.2000000000000002,1.6839209146108967 -7.3000000000000007,1.6676039305248551 -7.4000000000000004,1.4677753919938958 -7.5,1.5943284226073355 -7.6000000000000005,1.3487063819931264 -7.7000000000000002,1.4916746989442995 -7.8000000000000007,1.3579050651588507 -7.9000000000000004,1.2201516339395857 -8,1.0354727508078239 -8.1000000000000014,0.87649138728423037 -8.1999999999999993,0.77387261855386325 -8.3000000000000007,0.4536800046194267 -8.4000000000000004,0.23974455070849177 -8.5,0.28174991982090863 -8.6000000000000014,0.17716212958380056 -8.6999999999999993,0.2300092768999859 -8.8000000000000007,-0.04592404352469065 -8.9000000000000004,0.021685712091274192 -9,0.11126106098973793 -9.0999999999999996,0.13994288990456027 -9.2000000000000011,-0.02788752686137759 -9.3000000000000007,0.0024405644345866159 -9.4000000000000004,0.03467349958429617 -9.5,0.062619838733266583 -9.5999999999999996,0.25690494810827541 -9.7000000000000011,0.17227340213228237 -9.8000000000000007,0.1249762313228136 -9.9000000000000004,0.22426593455377142 -10,0.22483299693724429 diff --git a/Tutorial3_Curve_fitting/README.md b/Tutorial3_Curve_fitting/README.md deleted file mode 100644 index 0b8b421..0000000 --- a/Tutorial3_Curve_fitting/README.md +++ /dev/null @@ -1 +0,0 @@ -# Curve fitting diff --git a/Tutorial3_Curve_fitting/Scilab_code/README.md b/Tutorial3_Curve_fitting/Scilab_code/README.md deleted file mode 100644 index 37230ff..0000000 --- a/Tutorial3_Curve_fitting/Scilab_code/README.md +++ /dev/null @@ -1 +0,0 @@ -# Scilab code for curve fitting diff --git a/Tutorial3_Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce b/Tutorial3_Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce deleted file mode 100644 index 43e34db..0000000 --- a/Tutorial3_Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce +++ /dev/null @@ -1,33 +0,0 @@ -//This function is for curve fitting using least-square - -clear -clc - -//The function to be fitted -exec fit_function.sci; -//The error function -exec errorfun.sci; - -//Read measured data -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial3_Curve_fitting/Data/Tut3_Data.csv') -//Time stamp -time = Data(:,1); -//Measured output -measured_data = Data(:,2); - -// initial parameters guess -initial_condition = [1 ; 1]; - -//Call least square function, -//Output is function value (func_value_xopt) at optimal coefficients (x_optimal)) -[func_value_xopt,coeff_optimal] = leastsq(list(errorfun,time,measured_data),initial_condition) - -error = errorfun(coeff_optimal,time,measured_data) -disp(error,'The error after least square approximation') - - -// Plot of measured data and fitted data versus time -fitted_data = fit_function(time, coeff_optimal); -plot2d(time, [measured_data,fitted_data], [-1,2]) -legend(["measure points", "fitted curve"],[-1,2],"ur"); -xtitle("a simple fit with leastsq","time","data") diff --git a/Tutorial3_Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce b/Tutorial3_Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce deleted file mode 100644 index 866a070..0000000 --- a/Tutorial3_Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce +++ /dev/null @@ -1,37 +0,0 @@ -//This function is for curve fitting using least-square - -clear -clc - -//The function to be fitted -exec fit_function.sci; -//The error function -exec errorfunweight.sci; - -//Read measured data -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial3_Curve_fitting/Data/Tut3_Data.csv') -//Time stamp -time = Data(:,1); -//Measured output -measured_data = Data(:,2); - -// weights for data fitting -weight_matrix = [1 1 1 1 1 1 5 5 5 5 5 5 5]'; - - -// minimize f(x) = sum_i weight_matrix(i)^2 (weight_matrix(tm(i),a,b) - measured_data(i))^2 -// initial parameters guess -initial_condition = [1 ; 1]; - -//f is the function value at optimal x (xopt) -[func_value_xopt,x_optimal] = leastsq(list(errorfunweight,time,measured_data,weight_matrix),initial_condition) - -error = errorfunweight(x_optimal,time,measured_data,weight_matrix) -disp(error,'The error after least square approximation') - - -// a small graphic -fitted_data = fit_function(time, x_optimal); -plot2d(time, [measured_data,fitted_data], [-1,2]) -legend(["measure points", "fitted curve"],[-1,2],"ur"); -xtitle("a simple fit with leastsq","time","data") diff --git a/Tutorial3_Curve_fitting/Scilab_code/errorfun.sci b/Tutorial3_Curve_fitting/Scilab_code/errorfun.sci deleted file mode 100644 index 741ad63..0000000 --- a/Tutorial3_Curve_fitting/Scilab_code/errorfun.sci +++ /dev/null @@ -1,4 +0,0 @@ -//A function to compute error between computed data and measured data -function err = errorfun(x, time, measured_data) - err = (fit_function(time, x) - measured_data ) -endfunction diff --git a/Tutorial3_Curve_fitting/Scilab_code/errorfunweight.sci b/Tutorial3_Curve_fitting/Scilab_code/errorfunweight.sci deleted file mode 100644 index 9326d91..0000000 --- a/Tutorial3_Curve_fitting/Scilab_code/errorfunweight.sci +++ /dev/null @@ -1,4 +0,0 @@ -//A function to compute error between computed data and measured data -function err = errorfunweight(x, time, measured_data, weight_matrix) - err = weight_matrix.*(fit_function(time, x) - measured_data ) -endfunction diff --git a/Tutorial3_Curve_fitting/Scilab_code/fit_function.sci b/Tutorial3_Curve_fitting/Scilab_code/fit_function.sci deleted file mode 100644 index 49240e8..0000000 --- a/Tutorial3_Curve_fitting/Scilab_code/fit_function.sci +++ /dev/null @@ -1,6 +0,0 @@ -//The function to be fitted in the measured data -function y = fit_function(t, x) - a = x(1); - b = x(2); - y = a./(1+b.*t.*t) -endfunction diff --git a/Tutorial4_ODE/Problems/README.md b/Tutorial4_ODE/Problems/README.md deleted file mode 100644 index 5ccbfe0..0000000 --- a/Tutorial4_ODE/Problems/README.md +++ /dev/null @@ -1 +0,0 @@ -# Problems for ODE diff --git a/Tutorial4_ODE/Problems/Tut4.pdf b/Tutorial4_ODE/Problems/Tut4.pdf deleted file mode 100644 index 2ad3662..0000000 Binary files a/Tutorial4_ODE/Problems/Tut4.pdf and /dev/null differ diff --git a/Tutorial4_ODE/README.md b/Tutorial4_ODE/README.md deleted file mode 100644 index 841c27b..0000000 --- a/Tutorial4_ODE/README.md +++ /dev/null @@ -1 +0,0 @@ -# Ordinary differential equation diff --git a/Tutorial4_ODE/Scilab_code/README.md b/Tutorial4_ODE/Scilab_code/README.md deleted file mode 100644 index 78de9d2..0000000 --- a/Tutorial4_ODE/Scilab_code/README.md +++ /dev/null @@ -1 +0,0 @@ -# Scilab code for ODE diff --git a/Tutorial4_ODE/Scilab_code/Tutorial4_ode_matrix.sce b/Tutorial4_ODE/Scilab_code/Tutorial4_ode_matrix.sce deleted file mode 100644 index 33e5e33..0000000 --- a/Tutorial4_ODE/Scilab_code/Tutorial4_ode_matrix.sce +++ /dev/null @@ -1,21 +0,0 @@ -//This script demonstrates the use of ODE solver when matrix is involved -clear -clc - -//Definition of the function -function ydot = func(t,y) - ydot = A*y + ones(3,1); -endfunction - -//Defining the matrix -A = [1 2 1;9 6 1;1 3 4]; -//Initial condition -y0 = [-1;2;3]; -//Start time -t0= 0; -//The time at which the solution is computed -t = 0.2; -//Calling the ode solver -sol=ode(y0,t0,t,func); -//Displaying the solution -disp(sol,"y(t) at t = 0.2"); diff --git a/Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple.sce b/Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple.sce deleted file mode 100644 index 66431a4..0000000 --- a/Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple.sce +++ /dev/null @@ -1,21 +0,0 @@ -//This script demonstrates the use of ODE solver -clear -clc - -//Definition the function. -//The function is dy/dt = cos(t)*sin(t) - tan(t) + 1 -function ydot = func(t,y) - ydot = t^2*exp(-2*t) + y -endfunction - -//Initial condition of the problem, a scalar or vector -y0 = -1; -//Initial time, a real scalar -t0= 0; -//The time at which the solution is computed -t = 0.2; -//Calling the ode solver -sol=ode(y0,t0,t,func); -//Displaying the solution -disp(sol,"y(t) at t = 0.2"); - diff --git a/Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple_plot.sce b/Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple_plot.sce deleted file mode 100644 index f2df913..0000000 --- a/Tutorial4_ODE/Scilab_code/Tutorial4_ode_simple_plot.sce +++ /dev/null @@ -1,26 +0,0 @@ -//This script demonstrates the use of ODE solver and computing the -//solution at different times. The output is in the form of a plot -//of time versus computed solution -clear -clc - -//Definition the function. -function ydot = func(t,y) - ydot = t^2*exp(-2*t) + y -endfunction - -//Initial condition -y0 = -1; -//Start time -t0= 0; - -//The array of time where the solution is computed -tf = 4:0.01:10; - -//Calling the ODE solver -sol=ode(y0,t0,tf,func); - - -//Plotting the result -plot(tf,sol,'Linewidth',3) -xtitle('Dynamics of y','Time','y(t)') diff --git a/Tutorial5_Solution_of_equations/Problems/README.md b/Tutorial5_Solution_of_equations/Problems/README.md deleted file mode 100644 index f7a9032..0000000 --- a/Tutorial5_Solution_of_equations/Problems/README.md +++ /dev/null @@ -1 +0,0 @@ -# Problems for non-linear equations diff --git a/Tutorial5_Solution_of_equations/Problems/Tut5.pdf b/Tutorial5_Solution_of_equations/Problems/Tut5.pdf deleted file mode 100644 index a8c2c51..0000000 Binary files a/Tutorial5_Solution_of_equations/Problems/Tut5.pdf and /dev/null differ diff --git a/Tutorial5_Solution_of_equations/README.md b/Tutorial5_Solution_of_equations/README.md deleted file mode 100644 index 56a4129..0000000 --- a/Tutorial5_Solution_of_equations/README.md +++ /dev/null @@ -1 +0,0 @@ -# Non-linear equations diff --git a/Tutorial5_Solution_of_equations/Scilab_code/README.md b/Tutorial5_Solution_of_equations/Scilab_code/README.md deleted file mode 100644 index 297d7b8..0000000 --- a/Tutorial5_Solution_of_equations/Scilab_code/README.md +++ /dev/null @@ -1 +0,0 @@ -# Scilab code for non-linear equations diff --git a/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce b/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce deleted file mode 100644 index dcd5510..0000000 --- a/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce +++ /dev/null @@ -1,22 +0,0 @@ -//This scilab script is to compute the solution of a linear equation -clear -clc - -//Example of Ax + b = 0 where unique solution exists -A = [1 2 3;3 2 1;2 4 5]; -b = [7;7;12]; -[x,kerA] = linsolve(A,b); -disp(x,'Solution of Ax + b',kerA,'kernel of A'); - -//Example of Py+q = 0 where solution does not exist -P = [1 2 3;3 2 1;4 4 4] -q = [1;2;1] -[y,kerP] = linsolve(P,q); -disp(y,'Solution of Py + q',kerP,'kernel of P'); - -//Example of Lz+m = 0 where infinite solutions exist -L = [1 2 3;3 2 1;4 4 4] -m = [1;1;2] -[z,kerL] = linsolve(L,m); -disp(z,'Solution of Lz + m',kerL,'kernel of L'); - diff --git a/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce b/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce deleted file mode 100644 index 7f2a9ce..0000000 --- a/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce +++ /dev/null @@ -1,21 +0,0 @@ -//This scilab script is to compute the solution of a nonlinear function with initial -//guess x_0 -clear -clc - - -//The nonlinear equation for which solutions are sought -exec func.sci; - - -//Initial guess for the solution -t0 = 0; - -//Computation of solution using fsolve -y_result = fsolve(t0,func); -//Display the solution in command window -disp(y_result,'Solution of the equation') - - - - diff --git a/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce b/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce deleted file mode 100644 index 2b5dce1..0000000 --- a/Tutorial5_Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce +++ /dev/null @@ -1,17 +0,0 @@ -//This scilab script is to compute the solution of a nonlinear function with initial -//guess x_0 -clear -clc - - -//The nonlinear equation for which solutions are sought -exec functwovar.sci; - - -//Initial guess for the solution -t0 = [0;0]; - -//Computation of solution using fsolve -y_result = fsolve(t0,functwovar); -//Display the solution in command window -disp(y_result,'Solution of the equation') diff --git a/Tutorial5_Solution_of_equations/Scilab_code/func.sci b/Tutorial5_Solution_of_equations/Scilab_code/func.sci deleted file mode 100644 index 013277d..0000000 --- a/Tutorial5_Solution_of_equations/Scilab_code/func.sci +++ /dev/null @@ -1,4 +0,0 @@ -//This is script to define a fuction -function y = func(t) - y = cos(t)*sin(t) - tan(t) + 1 -endfunction diff --git a/Tutorial5_Solution_of_equations/Scilab_code/functwovar.sci b/Tutorial5_Solution_of_equations/Scilab_code/functwovar.sci deleted file mode 100644 index 6506ce4..0000000 --- a/Tutorial5_Solution_of_equations/Scilab_code/functwovar.sci +++ /dev/null @@ -1,6 +0,0 @@ -//This is script to define a fuction -function y = functwovar(t) - x = t(1); - z = t(2); - y = [x^2+z^2-1;x^2*exp(-2*x) + z] -endfunction -- cgit