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
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 12: Spectral Estimation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.2: Power_Spectrum.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"//Example 12.2\n",
"clc;clear;close;\n",
"N=8;n=0:N-1;\n",
"f1=0.6;f2=0.62;\n",
"x=cos(2*%pi*f1*n)+cos(2*%pi*f2*n);\n",
"L1=8;\n",
"for k=0:L1-1\n",
" P1(k+1)=1/N*abs(x*(cos(%pi*n*k/L1)-%i*sin(%pi*n*k/L1))')^2\n",
"end\n",
"L2=16;\n",
"for k=0:L2-1\n",
" P2(k+1)=1/N*abs(x*(cos(%pi*n*k/L2)-%i*sin(%pi*n*k/L2))')^2;\n",
"end\n",
"L3=32;\n",
"for k=0:L3-1\n",
" P3(k+1)=1/N*abs(x*(cos(%pi*n*k/L3)-%i*sin(%pi*n*k/L3))')^2;\n",
"end\n",
"subplot(311);\n",
"plot2d3(0:L1-1,P1);title('L=8');\n",
"subplot(312);\n",
"plot2d3(0:L2-1,P2);title('L=16');\n",
"subplot(313);\n",
"plot2d3(0:L3-1,P3);title('L=32');"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.4: Frequency_resolution.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"//Example 12.4\n",
"clc;clear;close;\n",
"N=1000;\n",
"Q=10;\n",
"disp(N,'Length of sample sequence N=',Q,'Quality factor Q=');\n",
"f_bart=Q/(1.11*N);\n",
"f_w=Q/(1.39*N);\n",
"f_bt=Q/(2.34*N);\n",
"disp(f_bart,'Bartlett Frequency resolution =');\n",
"disp(f_w,'Welch Frequency resolution =');\n",
"disp(f_bt,'Blackman Turkey Frequency resolution =');"
]
}
],
"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
}
|