summaryrefslogtreecommitdiff
path: root/2252/CH6/EX6.6/Ex6_6.sce
blob: f6d351b2e91746e2365dafd9bdb902bbdf5454e0 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

i=linspace(0,0,2)
t=linspace(0,1,2)
plot2d(t,i)
for j=0:3
    i=linspace(40+20*j,40+20*j,2)
    t=linspace(j+1,j+2,2)
    plot2d(t,i)
    if j==0 then
        t=linspace(j+1,j+1,2)
        i=linspace(0,40,2)
        plot2d(t,i)
    else 
        t=linspace(j+1,j+1,2)
        i=linspace(40+20*(j-1),40+20*j,2)
        plot2d(t,i)
    end
end
for j=1:3
    i=linspace(100-20*j,100-20*j,2)
    t=linspace(j+4,j+5,2)
    plot2d(t,i)
    i=linspace(100-20*(j-1),100-20*j,2)
    t=linspace(j+4,j+4,2)
    plot2d(t,i)
end
i=linspace(40,0,2)
t=linspace(8,8,2)
plot2d(t,i)
i=linspace(0,0,2)
t=linspace(8,9,2)
plot2d(t,i)
for j=0:3
    i=linspace(-(40+20*j),-(40+20*j),2)
    t=linspace(j+9,j+10,2)
    plot2d(t,i)
    if j==0 then
        t=linspace(j+9,j+9,2)
        i=linspace(0,-40,2)
        plot2d(t,i)
    else 
        t=linspace(j+9,j+9,2)
        i=linspace(-40-20*(j-1),-40-20*j,2)
        plot2d(t,i)
end
end
for j=1:3
    i=linspace(-(100-20*j),-(100-20*j),2)
    t=linspace(j+12,j+13,2)
    plot2d(t,i)
    i=linspace(-100+20*(j-1),-100+20*j,2)
    t=linspace(j+12,j+12,2)
    plot2d(t,i)
end
i=linspace(0,-40,2)
t=linspace(16,16,2)
plot2d(t,i)
xtitle("Periodic current wave for example 6.6","time in seconds","current")

//calculating average value for this wave shape
Iavg=(0+40+60+80+100+80+60+40)/8
mprintf("Average value of current of given wave shape=%f A\n",Iavg)
//calculating RMS value for the given wave shape
Irms=sqrt((0^2+40^2+60^2+80^2+100^2+80^2+60^2+40^2)/8)
mprintf("RMS value of current of given wave shape=%f A\n",Irms)
//calculating form factor
x=Irms/Iavg
mprintf("Form factor of given wave form=%f\n",x)
//calculating peak factor
Imax=100//maximum value of current wave
y=Imax/Irms
mprintf("Peak factor of given wave=%f\n",y)
//calculating average and RMS value of current considering the wave to be sinusoidal having peak value of 100 A
Iavg=integrate('100/%pi*sin(theta)','theta',0,%pi)
mprintf("Average value of sine wave=%f A\n",Iavg)
Irms=sqrt(integrate('(100*sin(theta))^2/%pi','theta',0,%pi))
mprintf("RMS value of sine wave=%f A",Irms)