diff options
Diffstat (limited to '2915/CH5/EX5.4/Ex5_4.sce')
-rwxr-xr-x | 2915/CH5/EX5.4/Ex5_4.sce | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/2915/CH5/EX5.4/Ex5_4.sce b/2915/CH5/EX5.4/Ex5_4.sce new file mode 100755 index 000000000..1dd111e4f --- /dev/null +++ b/2915/CH5/EX5.4/Ex5_4.sce @@ -0,0 +1,23 @@ +//Example 5.4
+//To determine the period of given sinusoidal function
+clear,clc;
+
+multiple = 2; //multiplicity of angle
+period_sinx = 2*%pi ;//period of sin(x) in radians
+required_period = period_sinx / multiple;
+printf('Required period is %f radians',required_period);
+
+//Note that sin 2x “goes twice as fast” as sin x.
+//While sin x takes a full 2*pi radians to go through an entire cycle
+//sin 2x goes through an entire cycle in just pi radians
+
+x = linspace(-0,2*%pi,100);
+y = sin(2*x) ;
+z = sin(x) ;
+set(gca(),"grid",[4 4]);
+plot(x,y,'r-');
+plot(x,z,'b-');
+xlabel("$0\le x\le 2*pi$","fontsize",4,"color","red");
+ylabel("$y(x)=sin(2x)$","fontsize",4,"color","red");
+title("Example 5.4","color","blue","fontsize",9);
+legend(["sin(2x)";"sin(x)"]);
|