-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCosine.qml
164 lines (141 loc) · 3.89 KB
/
Cosine.qml
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
import QtQuick 2.0
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
Item {
id: rootItem
property alias wave: spinRectId
property int amp: 1
property int per: 10
property int pha: 0
property int len: 10
property int del: 0
Rectangle{
id: spinRectId
width: parent.width
height: parent.height
Row{
spacing: 45
x: spinRectId.x + 20
y: spinRectId.y + 80
Label{
height: parent.height
verticalAlignment: Text.AlignVCenter
text: "Amplitude:"
font.pixelSize: 17
}
SpinBox{
id: amplitude
from:-10
to:10
value:1
//signal ampChanged(int a, int p, int f, int l, int d)
onValueChanged: {
//ccdemo.cos(amplitude.value, period.value, phase.value, length.value, delay.value)
//amplitude.ampChanged.connect(spinRectId.updateSignal)
//amplitude.ampChanged(amplitude.value, period.value, phase.value, length.value, delay.value)
amp = amplitude.value
spinRectId.updateSignal(amplitude.value, period.value, phase.value, length.value, delay.value)
}
}
}
Row{
spacing: 45
x: spinRectId.x + 50
y: spinRectId.y + 170
Label{
height: parent.height
verticalAlignment: Text.AlignVCenter
text: "Period:"
font.pixelSize: 17
}
SpinBox{
id: period
from:1
to:10
value: 10
onValueChanged: {
spinRectId.updateSignal(amplitude.value, period.value, phase.value, length.value, delay.value)
per = period.value
}
}
}
Row{
spacing: 45
x: spinRectId.x + 53
y: spinRectId.y + 260
Label{
height: parent.height
verticalAlignment: Text.AlignVCenter
text: "Phase:"
font.pixelSize: 17
}
SpinBox{
id: phase
from:-10
to:10
value:0
onValueChanged: {
spinRectId.updateSignal(amplitude.value, period.value, phase.value, length.value, delay.value)
pha = phase.value
}
}
}
Row{
spacing: 45
x: spinRectId.x + 45
y: spinRectId.y + 350
Label{
height: parent.height
verticalAlignment: Text.AlignVCenter
text: "Length:"
font.pixelSize: 17
}
SpinBox{
id: length
from:1
to:10
value:10
onValueChanged: {
spinRectId.updateSignal(amplitude.value, period.value, phase.value, length.value, delay.value)
len = length.value
}
}
}
Row{
spacing: 45
x: spinRectId.x + 55
y: spinRectId.y + 440
Label{
height: parent.height
verticalAlignment: Text.AlignVCenter
text: "Delay:"
font.pixelSize: 17
}
SpinBox{
id: delay
from:-10
to:10
value: 0
onValueChanged: {
spinRectId.updateSignal(amplitude.value, period.value, phase.value, length.value, delay.value)
del = delay.value
}
}
}
function updateSignal(a, p, f, l, d){
sig.clear()
ccdemo.cos(a, p, f, l, d)
var c = ccdemo.sig_cos_y
var t = ccdemo.sig_cos_t
ccdemo.getxx(c, t)
ccdemo.gethh(c, t)
for(var i = 0; i< c.length; i++){
sig.append(t[i], c[i])
}
axisX.max = t[t.length-1]
axisX.min = t[0]
axisY.max = Math.max.apply(null, c)
axisY.min = Math.min.apply(null, c)
}
}
}