From 3d0c890de4ac7d9afd576e889bd2624437d79c70 Mon Sep 17 00:00:00 2001 From: Chayan Bhawal Date: Tue, 2 Oct 2018 10:19:33 +0530 Subject: Renamed_files_relative_path --- Tutorial01-Basics/Problems/Tut01.pdf | Bin 0 -> 67735 bytes Tutorial01-Basics/Problems/Tut01.tex | 23 +++++++++++++ Tutorial01-Basics/Problems/Tut1.pdf | Bin 67566 -> 0 bytes .../Scilab_code/Tutorial1_filehandling.sce | 25 ++++++++++++++ .../Scilab_code/Tutotial1_filehandling.sce | 23 ------------- Tutorial02-Plots/Problems/Tut02.pdf | Bin 0 -> 29258 bytes Tutorial02-Plots/Problems/Tut02.tex | 17 +++++++++ Tutorial02-Plots/Problems/Tut2.pdf | Bin 29099 -> 0 bytes .../Scilab_code/Tutorial2_multi_plotting.sce | 38 +++++++++++++++++++++ .../Scilab_code/Tutorial2_plot_save.sce | 32 +++++++++++++++++ .../Scilab_code/Tutorial2_plot_save_func.sce | 27 +++++++++++++++ .../Scilab_code/Tutorial2_plotting.sce | 16 +++++++++ Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce | 2 +- .../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 --------- Tutorial03-Curve_fitting/Problems/Tut03.pdf | Bin 0 -> 44113 bytes Tutorial03-Curve_fitting/Problems/Tut03.tex | 20 +++++++++++ Tutorial03-Curve_fitting/Problems/Tut3.pdf | Bin 43895 -> 0 bytes .../Scilab_code/Tutorial3_curve_fitting.sce | 2 +- .../Tutorial3_curve_fitting_weighted.sce | 2 +- Tutorial04-ODE/Problems/Tut04.pdf | Bin 0 -> 50462 bytes Tutorial04-ODE/Problems/Tut04.tex | 19 +++++++++++ Tutorial04-ODE/Problems/Tut4.pdf | Bin 50507 -> 0 bytes .../Problems/Tut05.pdf | Bin 0 -> 64739 bytes .../Problems/Tut05.tex | 15 ++++++++ Tutorial05-Solution_of_equations/Problems/Tut5.pdf | Bin 64565 -> 0 bytes .../Scilab_code/Tutorial5_linear_equation.sce | 22 ++++++++++++ .../Scilab_code/Tutorial5_nonlinear_equation.sce | 21 ++++++++++++ .../Tutorial5_nonlinear_equation_twovar.sce | 17 +++++++++ .../Scilab_code/Tutotial5_linear_equation.sce | 22 ------------ .../Scilab_code/Tutotial5_nonlinear_equation.sce | 21 ------------ .../Tutotial5_nonlinear_equation_twovar.sce | 17 --------- 34 files changed, 295 insertions(+), 199 deletions(-) create mode 100644 Tutorial01-Basics/Problems/Tut01.pdf create mode 100644 Tutorial01-Basics/Problems/Tut01.tex delete mode 100644 Tutorial01-Basics/Problems/Tut1.pdf create mode 100644 Tutorial01-Basics/Scilab_code/Tutorial1_filehandling.sce delete mode 100644 Tutorial01-Basics/Scilab_code/Tutotial1_filehandling.sce create mode 100644 Tutorial02-Plots/Problems/Tut02.pdf create mode 100644 Tutorial02-Plots/Problems/Tut02.tex delete mode 100644 Tutorial02-Plots/Problems/Tut2.pdf create mode 100644 Tutorial02-Plots/Scilab_code/Tutorial2_multi_plotting.sce create mode 100644 Tutorial02-Plots/Scilab_code/Tutorial2_plot_save.sce create mode 100644 Tutorial02-Plots/Scilab_code/Tutorial2_plot_save_func.sce create mode 100644 Tutorial02-Plots/Scilab_code/Tutorial2_plotting.sce delete mode 100644 Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce delete mode 100644 Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce delete mode 100644 Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce delete mode 100644 Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce create mode 100644 Tutorial03-Curve_fitting/Problems/Tut03.pdf create mode 100644 Tutorial03-Curve_fitting/Problems/Tut03.tex delete mode 100644 Tutorial03-Curve_fitting/Problems/Tut3.pdf create mode 100644 Tutorial04-ODE/Problems/Tut04.pdf create mode 100644 Tutorial04-ODE/Problems/Tut04.tex delete mode 100644 Tutorial04-ODE/Problems/Tut4.pdf create mode 100644 Tutorial05-Solution_of_equations/Problems/Tut05.pdf create mode 100644 Tutorial05-Solution_of_equations/Problems/Tut05.tex delete mode 100644 Tutorial05-Solution_of_equations/Problems/Tut5.pdf create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_linear_equation.sce create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_nonlinear_equation.sce create mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_nonlinear_equation_twovar.sce delete mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce delete mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce delete mode 100644 Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce diff --git a/Tutorial01-Basics/Problems/Tut01.pdf b/Tutorial01-Basics/Problems/Tut01.pdf new file mode 100644 index 0000000..41890eb Binary files /dev/null and b/Tutorial01-Basics/Problems/Tut01.pdf differ diff --git a/Tutorial01-Basics/Problems/Tut01.tex b/Tutorial01-Basics/Problems/Tut01.tex new file mode 100644 index 0000000..e7318ee --- /dev/null +++ b/Tutorial01-Basics/Problems/Tut01.tex @@ -0,0 +1,23 @@ +\documentclass[10pt,a4paper]{article} +\usepackage[utf8]{inputenc} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\begin{document} +\title{Problems for Tutorial-01: Basics of Scilab} +\date{} +\maketitle +\begin{enumerate} +\item Write a Scilab script to compute the following: +\begin{enumerate} +\item $n_1 = \sqrt{(Ax - y)^T(Ax - y)}$ +\item $n_2 = $ Sum of elements of $(Ax-b)$ (Hint: Use sum command) +\item $n_3 = $ Sum of square of the elements of $(Ax - b)$ (Hint: Use for loop) +\end{enumerate} +where $A = \begin{bmatrix}a & a^2 & a^3\\b & b^2 & b^3\\c & c^2 & c^3\end{bmatrix}$, +$a = 1, b = 2, c = 3$, $x = \begin{bmatrix}1\\1\\1\end{bmatrix}$, +$y = \begin{bmatrix}4\\12\\36\end{bmatrix}$. +\item Write a Scilab script to save the solution of Problem $1$, i.e., +$\begin{bmatrix}n_1 & n_2 & n_3\end{bmatrix}$ as Problem2.csv file. +\end{enumerate} +\end{document} \ No newline at end of file diff --git a/Tutorial01-Basics/Problems/Tut1.pdf b/Tutorial01-Basics/Problems/Tut1.pdf deleted file mode 100644 index 24abc4f..0000000 Binary files a/Tutorial01-Basics/Problems/Tut1.pdf and /dev/null differ diff --git a/Tutorial01-Basics/Scilab_code/Tutorial1_filehandling.sce b/Tutorial01-Basics/Scilab_code/Tutorial1_filehandling.sce new file mode 100644 index 0000000..8942278 --- /dev/null +++ b/Tutorial01-Basics/Scilab_code/Tutorial1_filehandling.sce @@ -0,0 +1,25 @@ +//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/Result.csv') + + diff --git a/Tutorial01-Basics/Scilab_code/Tutotial1_filehandling.sce b/Tutorial01-Basics/Scilab_code/Tutotial1_filehandling.sce deleted file mode 100644 index 2924f03..0000000 --- a/Tutorial01-Basics/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/Tutorial02-Plots/Problems/Tut02.pdf b/Tutorial02-Plots/Problems/Tut02.pdf new file mode 100644 index 0000000..a159ad2 Binary files /dev/null and b/Tutorial02-Plots/Problems/Tut02.pdf differ diff --git a/Tutorial02-Plots/Problems/Tut02.tex b/Tutorial02-Plots/Problems/Tut02.tex new file mode 100644 index 0000000..cc6caca --- /dev/null +++ b/Tutorial02-Plots/Problems/Tut02.tex @@ -0,0 +1,17 @@ +\documentclass[10pt,a4paper]{article} +\usepackage[utf8]{inputenc} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\begin{document} +\title{Problems for Tutorial-02: Scientific Plotting} +\date{} +\maketitle +\begin{enumerate} +\item Write a Scilab script to plot the data in Tut2Problem.csv. +The first column is the x-axes data. Use proper legends and labels. +(If required use semilog/loglog plot). +\item Save a print quality pdf file of the figure generated. Name the +file Tut2fig1.pdf. +\end{enumerate} +\end{document} \ No newline at end of file diff --git a/Tutorial02-Plots/Problems/Tut2.pdf b/Tutorial02-Plots/Problems/Tut2.pdf deleted file mode 100644 index ddc5da8..0000000 Binary files a/Tutorial02-Plots/Problems/Tut2.pdf and /dev/null differ diff --git a/Tutorial02-Plots/Scilab_code/Tutorial2_multi_plotting.sce b/Tutorial02-Plots/Scilab_code/Tutorial2_multi_plotting.sce new file mode 100644 index 0000000..cf89ab5 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutorial2_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('../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/Tutorial2_plot_save.sce b/Tutorial02-Plots/Scilab_code/Tutorial2_plot_save.sce new file mode 100644 index 0000000..40f02cd --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutorial2_plot_save.sce @@ -0,0 +1,32 @@ +//This script demonstrate exporting plots to svg/pdf files +clear +clc + +//Import data from file +Data = csvRead('../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/Tutorial2_plot_save_func.sce b/Tutorial02-Plots/Scilab_code/Tutorial2_plot_save_func.sce new file mode 100644 index 0000000..c6a2883 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutorial2_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('../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/Tutorial2_plotting.sce b/Tutorial02-Plots/Scilab_code/Tutorial2_plotting.sce new file mode 100644 index 0000000..a8c6b64 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutorial2_plotting.sce @@ -0,0 +1,16 @@ +//This script demonstrate basic plot command in Scilab +clear +clc + +//Import data from file +Data = csvRead('../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/Tutorial2_semilog.sce b/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce index 9acc3a6..6aa73cf 100644 --- a/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce +++ b/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce @@ -4,7 +4,7 @@ clc exec change_plot_attribs.sci; //Import data from file -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); +Data = csvRead('../Data/Tut2_data1.csv'); //Segregate the data into variables y = Data(:,1); diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce deleted file mode 100644 index ec5b193..0000000 --- a/Tutorial02-Plots/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/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce deleted file mode 100644 index a3da8f3..0000000 --- a/Tutorial02-Plots/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/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce deleted file mode 100644 index d8f9963..0000000 --- a/Tutorial02-Plots/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/Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce deleted file mode 100644 index 5494863..0000000 --- a/Tutorial02-Plots/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/Tutorial03-Curve_fitting/Problems/Tut03.pdf b/Tutorial03-Curve_fitting/Problems/Tut03.pdf new file mode 100644 index 0000000..68f3f54 Binary files /dev/null and b/Tutorial03-Curve_fitting/Problems/Tut03.pdf differ diff --git a/Tutorial03-Curve_fitting/Problems/Tut03.tex b/Tutorial03-Curve_fitting/Problems/Tut03.tex new file mode 100644 index 0000000..b759479 --- /dev/null +++ b/Tutorial03-Curve_fitting/Problems/Tut03.tex @@ -0,0 +1,20 @@ +\documentclass[10pt,a4paper]{article} +\usepackage[utf8]{inputenc} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\begin{document} +\title{Problems for Tutorial-03: Curve Fitting} +\date{} +\maketitle +\begin{enumerate} +\item Fit the data present in the file Tut3Problem.csv to the function +\begin{align*} + \mathcal{G} = \left(K + \omega \cos(t)\right)\sin(t), +\end{align*} +where $K$ and $\omega$ are unknown. The first column +in Tut3Problem.csv is $t$ and the second column is the measured data. (Use least +squares fitting). +\item Plot the measured data and fitted data versus $t$. +\end{enumerate} +\end{document} \ No newline at end of file diff --git a/Tutorial03-Curve_fitting/Problems/Tut3.pdf b/Tutorial03-Curve_fitting/Problems/Tut3.pdf deleted file mode 100644 index c65c9e2..0000000 Binary files a/Tutorial03-Curve_fitting/Problems/Tut3.pdf and /dev/null differ diff --git a/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce b/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce index 43e34db..3dc7e27 100644 --- a/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce +++ b/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting.sce @@ -9,7 +9,7 @@ exec fit_function.sci; exec errorfun.sci; //Read measured data -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial3_Curve_fitting/Data/Tut3_Data.csv') +Data = csvRead('../Data/Tut3_Data.csv') //Time stamp time = Data(:,1); //Measured output diff --git a/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce b/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce index 866a070..39973bc 100644 --- a/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce +++ b/Tutorial03-Curve_fitting/Scilab_code/Tutorial3_curve_fitting_weighted.sce @@ -9,7 +9,7 @@ exec fit_function.sci; exec errorfunweight.sci; //Read measured data -Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial3_Curve_fitting/Data/Tut3_Data.csv') +Data = csvRead('../Data/Tut3_Data.csv') //Time stamp time = Data(:,1); //Measured output diff --git a/Tutorial04-ODE/Problems/Tut04.pdf b/Tutorial04-ODE/Problems/Tut04.pdf new file mode 100644 index 0000000..cd469c8 Binary files /dev/null and b/Tutorial04-ODE/Problems/Tut04.pdf differ diff --git a/Tutorial04-ODE/Problems/Tut04.tex b/Tutorial04-ODE/Problems/Tut04.tex new file mode 100644 index 0000000..9106a2c --- /dev/null +++ b/Tutorial04-ODE/Problems/Tut04.tex @@ -0,0 +1,19 @@ +\documentclass[10pt,a4paper]{article} +\usepackage[utf8]{inputenc} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\begin{document} +\title{Problems for Tutorial-04: \\Ordinary Differential equations} +\date{} +\maketitle +\begin{enumerate} +\item Find the solution of the differential equation at time $t = 10$ +\begin{align*} + \dot{x}_1 &= -x_1 + 3 x_2 + 2\\ + \dot{x}_2 &= -2 x_2 + 1 +\end{align*} +Consider the initial condition be $(0.1,0.2)$ at $t = 0$. +\item Plot the solution of the above differential $(x_1,x_2)$ for $t \in [0.2,10]$. +\end{enumerate} +\end{document} \ No newline at end of file diff --git a/Tutorial04-ODE/Problems/Tut4.pdf b/Tutorial04-ODE/Problems/Tut4.pdf deleted file mode 100644 index 2ad3662..0000000 Binary files a/Tutorial04-ODE/Problems/Tut4.pdf and /dev/null differ diff --git a/Tutorial05-Solution_of_equations/Problems/Tut05.pdf b/Tutorial05-Solution_of_equations/Problems/Tut05.pdf new file mode 100644 index 0000000..8f77d1c Binary files /dev/null and b/Tutorial05-Solution_of_equations/Problems/Tut05.pdf differ diff --git a/Tutorial05-Solution_of_equations/Problems/Tut05.tex b/Tutorial05-Solution_of_equations/Problems/Tut05.tex new file mode 100644 index 0000000..55d52ae --- /dev/null +++ b/Tutorial05-Solution_of_equations/Problems/Tut05.tex @@ -0,0 +1,15 @@ +\documentclass[10pt,a4paper]{article} +\usepackage[utf8]{inputenc} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\begin{document} +\title{Problems for Tutorial-05: Solution of equations} +\date{} +\maketitle +\begin{enumerate} +\item Write a Scilab script to find the intersection of the circle +$x^2 + y^2 - 25 = 0$ and the plane $x + 2y = 5$. +\item Find the solution of the equation $te^{-xt} + cos(t)sin(t) + x = 0$ and $x+z-1 = 0$. +\end{enumerate} +\end{document} diff --git a/Tutorial05-Solution_of_equations/Problems/Tut5.pdf b/Tutorial05-Solution_of_equations/Problems/Tut5.pdf deleted file mode 100644 index a8c2c51..0000000 Binary files a/Tutorial05-Solution_of_equations/Problems/Tut5.pdf and /dev/null differ diff --git a/Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_linear_equation.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_linear_equation.sce new file mode 100644 index 0000000..dcd5510 --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_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/Tutorial5_nonlinear_equation.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_nonlinear_equation.sce new file mode 100644 index 0000000..7f2a9ce --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_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/Tutorial5_nonlinear_equation_twovar.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_nonlinear_equation_twovar.sce new file mode 100644 index 0000000..2b5dce1 --- /dev/null +++ b/Tutorial05-Solution_of_equations/Scilab_code/Tutorial5_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/Tutotial5_linear_equation.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_linear_equation.sce deleted file mode 100644 index dcd5510..0000000 --- a/Tutorial05-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/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation.sce deleted file mode 100644 index 7f2a9ce..0000000 --- a/Tutorial05-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/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce b/Tutorial05-Solution_of_equations/Scilab_code/Tutotial5_nonlinear_equation_twovar.sce deleted file mode 100644 index 2b5dce1..0000000 --- a/Tutorial05-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') -- cgit