summaryrefslogtreecommitdiff
path: root/Working_Examples/154/DEPENDENCIES/ch2_1.sce
blob: bbb83e9ec4446ae80f139b6a87d373df5f7f1844 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
clc
disp("Example 2.1")
printf("\n")
printf("Given")
disp("Resistance used is 4 ohm")
disp("Current flow is i=2.5*sin(w*t)")
disp("Angular frequency(w)=500 rad/s")

R=4;
iamp=2.5;w=500;
t=0:0.001:0.012566
i=2.5*sin(w*t)


Vamp=iamp*R;
printf("v=%d*sin(%d*t)(V)\n",Vamp,w)

pamp=iamp*iamp*R;
printf("p=%d(sin(%d*t))^2(W)\n",pamp,w)
p=pamp*sin(w*t)^2;

//On integrating p with respect to t
W=25*(t/2-sin(2*w*t)/(4*w))

function p=f(t),p=pamp*sin(w*t)^2,endfunction
w1=intg(0,2*%pi/w,f);

figure
a= gca ();
plot(t,i)
xtitle ('i vs wt','wt','i ');
a. thickness = 2;

figure
a= gca ();
plot(t,p)
xtitle ('p vs wt','wt','p ');
a. thickness = 2;

figure
a= gca ();
plot(t,W)
xtitle ('w vs wt','wt','w ');
a. thickness = 2;