summaryrefslogtreecommitdiff
path: root/2414/CH2/EX2.9/Ex2_9.sce
diff options
context:
space:
mode:
Diffstat (limited to '2414/CH2/EX2.9/Ex2_9.sce')
-rwxr-xr-x2414/CH2/EX2.9/Ex2_9.sce40
1 files changed, 40 insertions, 0 deletions
diff --git a/2414/CH2/EX2.9/Ex2_9.sce b/2414/CH2/EX2.9/Ex2_9.sce
new file mode 100755
index 000000000..b945c092e
--- /dev/null
+++ b/2414/CH2/EX2.9/Ex2_9.sce
@@ -0,0 +1,40 @@
+clc;
+clear all;
+//page no 54
+//problem 2.9
+f0=0;
+f1=500; //fundamental freq.
+f2=1000; f3=1500; //harmonics
+
+//Values from ex 2.4
+C=[5 8 6 3]// Values in Volts
+//Values from ex 2.5
+P=[5 6.4 3.6 .9]; //poweer in watts
+clf;
+// plot two sided linear amplitude spectrum
+fHz=-1510:10^-2:1510; //x-axis matrix
+//Y-axis matrix
+Cn=[C(1)]
+for i=2:4
+ Cn=[zeros(-500+10^-2:10^-2:0-10^-2) Cn zeros(0+10^-2:10^-2:500-10^-2)]
+ Cn=[C(i)/2 Cn C(i)/2];
+end
+Cn=[zeros(-10+10^-2:10^-2:0) Cn zeros(0:10^-2:10-10^-2)]
+subplot(211)
+plot2d(fHz,Cn,[2],rect=[-2000,0,2000,6])
+xtitle('Two-sided Linear amplitude spectrum','f,Hz','Vn(V)')
+xgrid
+
+// plot two power spectrum
+fHz=-1510:10^-2:1510; //x-axis matrix
+//Y-axis matrix
+Pn=[P(1)]
+for i=2:4
+ Pn=[zeros(-500+10^-2:10^-2:0-10^-2) Pn zeros(0+10^-2:10^-2:500-10^-2)]
+ Pn=[P(i)/2 Pn P(i)/2];
+end
+Pn=[zeros(-10+10^-2:10^-2:0) Pn zeros(0:10^-2:10-10^-2)]
+subplot(212)
+plot2d(fHz,Pn,[6],rect=[-2000,0,2000,6])
+xtitle('Two-sided power] spectrum','f,Hz','Pn(W)')
+xgrid