From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 1415/CH1/EX1.1.3/ex3.jpg | Bin 0 -> 48990 bytes 1415/CH1/EX1.1.3/ex3.sce | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 1415/CH1/EX1.1.3/ex3.jpg create mode 100644 1415/CH1/EX1.1.3/ex3.sce (limited to '1415/CH1/EX1.1.3') diff --git a/1415/CH1/EX1.1.3/ex3.jpg b/1415/CH1/EX1.1.3/ex3.jpg new file mode 100644 index 000000000..f964038a8 Binary files /dev/null and b/1415/CH1/EX1.1.3/ex3.jpg differ diff --git a/1415/CH1/EX1.1.3/ex3.sce b/1415/CH1/EX1.1.3/ex3.sce new file mode 100644 index 000000000..e8362ff3b --- /dev/null +++ b/1415/CH1/EX1.1.3/ex3.sce @@ -0,0 +1,43 @@ +//Example 3 Page 48 +clc +clear +//defining the function +function y=f(x) +if(x >= -4 & x < -1) then//check value of x +y=-1; +elseif(x >= -1 & x <= 1) then//check value of x +y=x; +elseif(x > 1 & x <= 2) then//check value of x +y=x^2-1; +end +endfunction + +disp('a)') +x=-2;//assigning value to x +y=f(x)//function calling +disp(y) +x=-1;//assigning value to x +y=f(x)//function calling +disp(y) +x=0;//assigning value to x +y=f(x)//function calling +disp(y) +x=1;//assigning value to x +y=f(x)//function calling +disp(y) +x=2;//assigning value to x +y=f(x)//function calling +disp(y) + +disp('b)') +x=[-4 -3 ]//assigning values to x +y=f(x)//function calling +disp(y) +plot(4,4,x,y,'green')//plotting on graph +x=[-1 0 1]//assigning values to x +y=f(x)//function calling +plot(4,4,x,y,'red')//plotting on graph +x=[1.1 1.3 1.5 2]//assigning values to x +y=f(x)//function calling +plot(4,4,x,y,'blue')//plotting on graph +xtitle('','x','y'); -- cgit