1.
請參考第8章Image物件類別設計一個浮點數值的Signal物件類別
class f1d
{
public:
float *m;
int nb;
void Initialize(int size)
{
nb=size;
m=new float[nb];
}
void Read(char *filename)
{
}
void Write(char *filename)
{
}
};
2. 如果有以下資料檔x.txt
12.84849274
14.82668884
50.1050118
75.96767783
103.3198145
92.93425309
106.4216096
94.73952431
50.01714326
11.4995642
26.18547486
-50.43812158
-30.36678182
-80.57933466
-96.46307188
-121.1850502
-76.15342743
-106.4449869
-65.92832579
-41.22356839
-2.026818472
31.7708202
19.17698299
80.59449431
99.06828845
79.90912762
102.2920311
72.68556018
74.83844943
69.0692863
29.01292334
-15.5563412
-50.62906419
-76.22666889
-73.31358143
-96.05672401
-108.4140577
-98.21289665
-66.24007825
-72.76660036
-59.32135462
-2.284768532
10.02364362
53.40136336
47.21947927
96.35639302
121.8073083
124.745629
79.97507653
93.66283085
53.60570844
24.38805467
20.0924828
-51.90485498
-78.11394827
-63.120763
-111.6541424
-122.8998445
-91.83411121
-95.10731974
-85.58149449
-20.42960138
-13.28389689
1.475196148
66.29838505
47.72178024
102.5192201
74.74471722
97.36178389
115.4969615
68.78534521
75.08717183
13.94526079
-6.507205392
-47.06901745
-49.30909479
-56.15914574
-93.65474745
-112.4204033
-86.6674709
-103.7893125
-46.42204235
-25.39119959
8.961244789
-2.571975596
56.76729587
80.4808333
82.16672526
110.6249076
100.2797665
112.0098687
66.76666762
48.58422351
7.93587544
18.65066626
-15.1071598
-74.00014313
-96.20771251
-107.2002209
-117.5785775
-121.4813266
-103.8396206
-84.49811028
-23.3156848
-14.69800101
9.327507142
49.35847949
76.84369889
100.4517648
102.3293133
105.9839314
73.37800034
95.28092103
42.22886652
4.207224328
-5.917563431
-38.04937823
-80.13299582
-84.29124811
-82.55983153
-94.46504556
-108.3458187
-102.7557239
-70.81860989
-45.17259269
-11.17623128
-4.496148066
32.18062101
請寫一個主程式將x.txt讀進程式的記憶體,再將其輸出至y.txt。
3. 新增一個計算最大值的成員函式
int getMax( )
4. 新增一個計算最大值的成員函式
int getMin( )
5. 新增一個計算normalization的成員函式,可將signal資料的值域變換至[0, 1]之間。使用
m' = (m-min)/(max-min)
|