summaryrefslogtreecommitdiff
path: root/2915/CH5/EX5.7/Ex5_7.sce
blob: 23e70a4ea077f2b1a3a26fa367ea5c2d9ce93b33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Example 5.7
//To find amplitude and period of given composite function 
clear,clc;

x = linspace(0,3,200);
y1=2 ;//1st part of given function
amplitude1=y1 ;//amplitude numerically same for constant function
y2= -3*sin((2*%pi/3)*x); //second part of given function
amplitude2 = abs(y2/sin((2*%pi/3)*x)) ;//amplitude of part 2
//Note: adding 2 doesnt change ampitude
//It just causes the upward shift of graph
maax =amplitude1 + amplitude2; //altered maximum due to adding of 2
minn =amplitude1 - amplitude2;//altered minimum due to adding of 2
amplitude = (maax-minn)/2;//required amplitude
printf('Amplitude = %f',amplitude);
 
multiple=2*%pi/3 ;//multiplicity of angle
period_sinx=2*%pi;//period of sin_x
period_required = period_sinx/ multiple;
printf('\nRequired period is %f radians',period_required);

x = linspace(0,3,200);
y = 2 -3*sin((2*%pi/3)*x)
set(gca(),"grid",[5 5]);
plot(x,y);
xlabel("$0\le x\le 3$","fontsize",4,"color","red");
ylabel("$y(x)= 2 -3*sin((2*%pi/3)*x)$","fontsize",4,"color","red");
title("Example 5.7","color","blue","fontsize",9);