summaryrefslogtreecommitdiff
path: root/Tutorial5_Nonlinear_equation
diff options
context:
space:
mode:
authorChayan Bhawal2018-09-27 21:08:17 +0530
committerChayan Bhawal2018-09-27 21:08:17 +0530
commit032dc034194100cb3428d073efd0a8ed05c3accd (patch)
treed5b675cb44a4085d95121dccfd92b7ba50bc13ab /Tutorial5_Nonlinear_equation
parenta58151ad625782ff6bb5c45db686912e4cd84e1d (diff)
downloadscilab-tutorials-032dc034194100cb3428d073efd0a8ed05c3accd.tar.gz
scilab-tutorials-032dc034194100cb3428d073efd0a8ed05c3accd.tar.bz2
scilab-tutorials-032dc034194100cb3428d073efd0a8ed05c3accd.zip
Updating Plot folder
Diffstat (limited to 'Tutorial5_Nonlinear_equation')
-rw-r--r--Tutorial5_Nonlinear_equation/Scilab_code/Tutotial5_nonlinear_equation.sce16
1 files changed, 14 insertions, 2 deletions
diff --git a/Tutorial5_Nonlinear_equation/Scilab_code/Tutotial5_nonlinear_equation.sce b/Tutorial5_Nonlinear_equation/Scilab_code/Tutotial5_nonlinear_equation.sce
index 6ab3a23..6d38c84 100644
--- a/Tutorial5_Nonlinear_equation/Scilab_code/Tutotial5_nonlinear_equation.sce
+++ b/Tutorial5_Nonlinear_equation/Scilab_code/Tutotial5_nonlinear_equation.sce
@@ -10,10 +10,22 @@ function y = nonlinear_func(x)
endfunction
-//Initial guess for the solution
+//Initial guess for the solution
x0 = 0;
//Computation of solution using fsolve
y_result = fsolve(x0,nonlinear_func);
-
+//Display the solution in command window
disp(y_result,'Solution of the equation')
+
+
+//Plot of cos(x)*sin(x) and tan(x)-1 to check validity of the solution of fsolve
+//To create data-points for computation of the functions cos(x)*sin(x) and tan(x)-1
+t = linspace(-201,-200);
+z1 = cos(t).*sin(t);
+z2 = tan(t)-1*ones(length(t));
+
+//To plot t versus cos(t)*sin(t) and tan(t)-1
+plot2d(t,[z1' z2'])
+
+