Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Removing large DC offset in FFT

Status
Not open for further replies.

ilter

Member level 4
Joined
Jul 22, 2005
Messages
77
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,095
Dear,
This is my code.
numpt=512; % points
fclk=256e6; % sampling frequency

load saradcdata1.txt; % Load data from disk;
for i=1:512;
code(1,i)=saradcdata1(i,2);
end
window=hamming(numpt);
Doutw=code'.*window;
Dout_spect=fft(Doutw);
Dout_dB=20*log10(abs(Dout_spect));
figure;
maxdB=max(Dout_dB(1:numpt/2));
plot([0:numpt/2-1].*fclk/numpt,Dout_dB(1:numpt/2)-maxdB);
grid on;
title('FFT PLOT');
xlabel('ANALOG INPUT FREQUENCY (MHz)'); ylabel('AMPLITUDE (dB)');


My picture is below.
I have a question.
You can see (1) and (2).
My signal is 1.5M. My clock is 256M.
What produce (1) and (2).
Is my code wrong?
or why?


This is my data. (512 points)
312
314.64
337.92
338.86
360.93
361.8
383.13
383.66
404.37
404.92
425.32
426.13
445.95
446.57
465.07
465.7
483.6
484.25
501.08
501.87
517.91
518.98
533.56
534.19
547.44
548.11
560.68
561.58
572.75
573.6
582.93
583.47
591.89
592.53
599.22
599.72
605
605.63
609.69
610.15
612.04
612.14
612.63
613.06
612.38
612.58
610.68
610.55
606.65
606.57
601.2
601.16
594.05
593.71
585.25
585.01
575.04
574.76
563
562.56
549.77
549.35
535.48
534.93
519.14
518.74
501.73
501.54
484.05
483.72
465.11
464.76
445.12
444.69
424.21
423.87
402.78
402.28
380.82
380.53
358.75
358.63
336.35
335.96
313.8
313.45
290.93
290.63
268.48
268.53
246.1
245.81
223.95
223.69
202.4
202.29
181.3
181.26
161.15
161.08
141.53
141.49
122.92
122.98
105.48
105.42
88.881
88.805
73.486
73.489
59.537
59.523
46.928
46.874
35.383
35.465
25.687
25.695
17.456
17.431
10.647
10.672
5.6017
5.5621
2.1797
2.1445
0.30203
0.30809
0.18041
0.15995
1.6843
1.6913
4.9349
4.9067
9.8223
9.7886
16.212
16.156
24.227
24.169
33.876
33.747
44.863
44.755
57.345
57.263
71.107
70.974
86.244
86.076
102.4
102.28
119.55
119.47
137.95
137.76
157.24
157.03
177.01
176.93
197.69
197.73
218.81
218.81
240.53
240.51
262.51
262.58
284.72
284.88
307.18
307.38
329.42
329.77
351.69
351.83
373.58
373.87
395.24
395.52
416.17
416.62
436.74
436.98
456.59
457.17
475.64
476.08
493.79
494.31
510.75
511.19
526.87
527.57
541.88
542.69
555.32
556.11
567.76
568.25
578.5
578.99
587.81
588.43
595.79
596.29
602.28
602.69
607.41
608.31
611.2
611.49
612.53
612.98
613.45
613.5
611.64
611.6
608.49
608.42
603.75
603.45
597.08
596.83
589.29
588.83
579.61
579.37
568.72
568.31
556.24
555.84
542.19
542.1
527.11
526.92
510.2
509.78
492.46
492.08
474.1
473.34
454.42
453.97
433.88
433.57
413.05
412.67
391.38
391.21
369.35
368.85
346.78
346.63
324.4
324.21
301.69
301.35
279.03
278.91
256.57
256.46
234.5
234.29
212.58
212.4
191.06
191.08
170.6
170.43
150.51
150.54
131.63
131.57
113.5
113.41
96.404
96.477
80.601
80.589
66.051
65.954
52.5
52.603
40.767
40.726
30.206
30.195
21.183
21.189
13.582
13.673
7.8604
7.8251
3.6532
3.6285
0.98165
0.93274
0.26561
0.0054064
0.82708
0.77361
3.3212
3.2329
7.2376
7.2149
13.041
12.986
20.352
20.277
29.097
29.033
39.73
39.441
51.336
51.214
64.427
64.273
79.065
78.937
94.726
94.544
111.46
111.29
129.23
129.14
147.97
147.92
167.77
167.56
188
187.88
208.88
208.86
230.28
230.3
252.21
252.29
274.3
274.48
296.62
296.74
319.08
319.27
341.17
341.36
363.01
363.51
384.95
385.27
406.34
406.7
426.75
427.11
446.97
447.79
466.47
467.08
485.52
486.18
503.16
503.76
519.36
519.96
534.94
535.61
549.15
549.62
561.8
562.42
573.28
573.42
583.54
584.19
591.99
592.37
599.3
599.59
605.04
605.31
609.24
609.44
611.35
611.93
612.54
612.74
612.26
612.64
609.63
609.86
605.9
605.86
600.48
600.25
593.29
593.19
584.56
584.41
574.36
574.23
561.99
561.42
548.78
548.58
534.06
533.47
518.12
517.64
500.53
500.17
482.38
482.07
463.13
462.76
443.38
443
422.9
422.76
401.6
400.85
379.43
379.23
357.13
356.96
334.74
334.35
312.11
311.94
289.52
289.35
267.06
266.83
244.71
244.77
222.75
222.48
201.07
200.97
180.1
179.99
159.83
159.78
140.39
140.33
121.82
121.77
104.42
104.38
87.977
87.967
72.591
72.587
58.782
58.794
46.175
46.152
34.94
34.867
25.231
25.236
17.017
16.969
10.364
10.371
5.4525
5.4125
1.9901
1.9941
0.31159
0.31436
0.21795
0.15968
1.8869
1.8521
5.0945
5.068
10.064
10.087
16.63
16.616
24.874
24.812
34.407
34.355
45.706
45.538
58.097
57.963
71.88
71.776
87.136
87.027
103.33
103.2
120.67
120.49
138.98
138.91
158.31
158.2
178.36
178.24
198.78
198.76
220.12
220.11
241.78
241.82
263.71
263.87
286.16
312

Thanks very muxh.
 

Re: FFT question

no picture can be seen.
 

FFT question

(1) is produced by the large DC offset in your data.
(2) is produced by a small high-frequency signal in your data. Origin unknown, but it may be a distortion product between the sample rate and the 1.5 MHz main signal.

To remove the DC offset (and to fix a subscript error), try changing this:
code(1,i) = saradcdata1(i,2);
to this:
code(1,i) = saradcdata1(i,1) - mean(saradcdata1);
 

Re: FFT question

echo47 said:
(1) is produced by the large DC offset in your data.
(2) is produced by a small high-frequency signal in your data. Origin unknown, but it may be a distortion product between the sample rate and the 1.5 MHz main signal.

To remove the DC offset (and to fix a subscript error), try changing this:
code(1,i) = saradcdata1(i,2);
to this:
code(1,i) = saradcdata1(i,1) - mean(saradcdata1);

Dear echo47.Thank you.
why do (1) is -30dB? Maybe it will below -30dB.
And I have another question.
If I want to measue SFDR, is it like (3)?
Thanks.
 

Re: FFT question

Dear all,
When I do FFT, I have some question.
M is total number of sin wave periods.
N total sampling points.
Ft sine wave frequency.
Fs DAC sampling rate.

I am doing to measure SFDR of my dac.

1.why Ft/M=Fs/N?
2.why M and N must be prime
3.why M must be integer
4.My picture has some problems like (1)(2).why??
This picture is produced.
1.5MHz/3=256MHz/512.
Thanks.
 

FFT question

ilter, I don't know why your second plot shows 0Hz at only -30dB. I get a much lower amplitude. However, your second plot looks like a different data set. Are you removing the DC offset?

I'm no expert in SFDR, so I'll defer that question to other folks.
 

Re: FFT question

echo47 said:
ilter, I don't know why your second plot shows 0Hz at only -30dB. I get a much lower amplitude. However, your second plot looks like a different data set. Are you removing the DC offset?
Yes
I'm no expert in SFDR, so I'll defer that question to other folks.
Thanks.
 

Re: FFT question

ilter said:
Dear all,
When I do FFT, I have some question.
M is total number of sin wave periods.
N total sampling points.
Ft sine wave frequency.
Fs DAC sampling rate.

I am doing to measure SFDR of my dac.

1.why Ft/M=Fs/N?
2.why M and N must be prime
3.why M must be integer
4.My picture has some problems like (1)(2).why??
This picture is produced.
1.5MHz/3=256MHz/512.
Thanks.

Hi.
let me first explain your third question. If M set to a non-integervalue, let's say 3.2, then this uncomplete period would be repeated in FFT calculation in order to build a periodic signal. Hence the resulting waveform would have a lot of distortion and final SNDR will be degraded dramatically. On the other hand, M and N must be prime to each other, in order to obtain N different (non-identical) points of the signal. otherwise, the SNDR would be overestimated. and why Ft/M = Fs/N? Let me write it in this way : Ft/Fs = M/N. this is the main concept of FFT calculation.

Regards,
EZT
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top