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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 18: Fourier Circuit Analysis"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 18.1: Trigonometric_form_of_the_Fourier_Series.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clear\n",
"close\n",
"clc\n",
"//Example 18.1\n",
"//From the figure 18.2\n",
"disp('The equation of v(t) considering one period can be written as')\n",
"disp('v(t)=Vm*cos(5*%pi*t) for -0.1<=t<=0.1')\n",
"disp('v(t)=0 for 0.1<=t<=0.3')\n",
"//Assuming the value of Vm is 1\n",
"Vm=1;\n",
"//Evaluating the constants an and bn\n",
"//bn=0 for all n\n",
"//an=(2*Vm*cos(n*%pi/2))/(%pi*(1-n^2))\n",
"//a0=Vm/%pi\n",
"t=-1:0.02:1\n",
"v0t=Vm/%pi\n",
"v1t=(1/2)*(Vm*cos(5*%pi*t))\n",
"v0t_v1t=v0t+v1t\n",
"v2t=(2/(3*%pi))*(Vm*cos(10*%pi*t))\n",
"v0t_v1t_v2t=v0t+v1t+v2t\n",
"v3t=(2/(15*%pi))*(Vm*cos(20*%pi*t))\n",
"v0t_v1t_v2t_v3t=v0t+v1t+v2t-v3t\n",
"figure\n",
"a = gca ();\n",
"a. y_location = 'origin';\n",
"a. x_location = 'origin';\n",
"a. data_bounds =[ -1,0;1 0.5];\n",
"plot (t,v0t)\n",
"xtitle('vot vs t','t in s','vot')\n",
"figure\n",
"a = gca ();\n",
"a. y_location = 'origin';\n",
"a. x_location = 'origin';\n",
"a. data_bounds =[ -1,-0.5;1 0.5];\n",
"plot (t,v0t_v1t)\n",
"a. y_location = 'origin';\n",
"a. x_location = 'origin';\n",
"a. data_bounds =[ -1,-0.5;1 0.5];\n",
"plot (t,v0t_v1t_v2t,'r.->')\n",
"a. y_location = 'origin';\n",
"a. x_location = 'origin';\n",
"a. data_bounds =[ -1,-0.5;1 0.5];\n",
"plot (t,v0t_v1t_v2t_v3t,'d')\n",
"xtitle('v(t)','t in s','v(t) in V')"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 18.5: Definition_of_the_Fourier_Transform.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//Example 18.5\n",
"//Let amplitude be 1 \n",
"A=1;\n",
"Dt=0.01;\n",
"T1=4;\n",
"t=0:Dt:T1/4;\n",
"for i=1:length(t)\n",
" xt(i)=A\n",
"end\n",
"//Calculate Fourier Transform\n",
"Wmax=2*%pi*1;\n",
"K=4;\n",
"k=-(2*K):(K/1000):(2*K);\n",
"W=k*Wmax/K;\n",
"xt=xt';\n",
"XW=xt*exp(-sqrt(-1)*t'*W)*Dt;\n",
"XW_Mag=real(XW);\n",
"W=[-mtlb_fliplr(W),W(2:1001)];\n",
"XW_Mag=[mtlb_fliplr(XW_Mag),XW_Mag(2:1001)];\n",
"subplot(2,1,1);\n",
"a=gca();\n",
"a.data_bounds=[0,0;1,1.5];\n",
"a.y_location='origin';\n",
"plot(t,xt);\n",
"xlabel('t in sec.');\n",
"title('v(t)vs t');\n",
"subplot(2,1,2);\n",
"a=gca();\n",
"a.y_location='origin';\n",
"plot(W*%pi/2,abs (XW_Mag));\n",
"xlabel('Freq in rad/sec');\n",
"ylabel('|F(jw)|')\n",
"title('|F(jw)| vs t');"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 18.6: Physical_significance_of_Fourier_Transform.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc\n",
"syms s t\n",
"printf('Given')\n",
"disp('v(t)=4*exp(-3*t)*u(t)')\n",
"v=4*exp(-3*t)\n",
"\n",
"F=4*(integ(exp(-(3+%i*1)*s),s,0,%inf))\n",
"//The secind term tends to zero\n",
"disp(F,'F=')\n",
"//Let W be the total 1 ohm energy in the input signal\n",
"W=integ(v^2,t,0,%inf)\n",
"disp(W,'W=')\n",
"//Let Wo be the total energy\n",
"//As the frequency range is given as 1 Hz<|f|<2 Hz\n",
"//Considering symmetry\n",
"Wo=(1/%pi)*integ((16/(9+s^2)),s,2*%pi,4*%pi)\n",
"disp(Wo,'Wo=')\n",
"\n",
"\n",
""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Scilab",
"language": "scilab",
"name": "scilab"
},
"language_info": {
"file_extension": ".sce",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "scilab",
"version": "0.7.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|