The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Simulators >> Circuit Simulators >> Fourier analysis and DFT compare https://designers-guide.org/forum/YaBB.pl?num=1179729208 Message started by driveforce on May 20th, 2007, 11:33pm |
Title: Fourier analysis and DFT compare Post by driveforce on May 20th, 2007, 11:33pm Hi, I did two simulations using ideal 10 bits ADC and DAC, and check the spectrum at the ideal DAC output. 1st one, fclk = 32MHz, fsig = 1MHz, DFT and Fourier analysis results match each other. 2nd one, fclk = 32MHz, fsig = 0.96875MHz. The Fourier analysis using the last period (38.9677us ~ 40us) to find the fourier coefficients. If I use the same period for DFT, the results match, as expected. If I use 8us to 40us to do DFT, which is exactly 31 periods (32us length), the DFT result shows less magnitude at harmonics. I would trust the DFT result more for the 2nd case. Any one can comment on this? Thanks! |
Title: Re: Fourier analysis and DFT compare Post by sheldon on May 23rd, 2007, 4:47am Driveforce, Some comments: 1) You using a fourier command like FOUR0 ( out 0) fourier fund=968710.6461 harms=?? As mentioned in one of the previous appends, it would be better to add the normharm property to the symbol FOUR0 ( out 0) fourier fund=31250 harms=1024 normharm=31 This will allow a direct comparison of the DFT and Fourier analysis results. Currently the analysis use different fundemental frequencies. 2) The period appears to be a little off, (31/1024)*32MHz = 968750Hz, 1/(40us-39.9677us)=968710.6461 Hz and this could result in spectral leakage that requires windowing. The Fourier component does not include a windowing function so you need to be careful about frequency selection. 3) An ideal DAC has quantitazation noise not distortion harmonics so you need to compare snr ( or sinad) in order to verify the results. 4) For non-ideal DACs, the results would not be expected to match since the DFT samples the waveform, i.e., that is it is difficult to capture the the effect of glitch impulse on the response. The Fourier component integrates over the waveform and is more suited for this measurement. Best Regards, Sheldon |
Title: Re: Fourier analysis and DFT compare Post by driveforce on May 23rd, 2007, 5:17pm Hi, Sheldon, Thanks for your reply. 1) I didn't use fourier command, and don't know hwo, instead, I use fourier analysis in GUI, as shown in the following. The plus terminal should be connected output, not ground. 2) the period is automaticlly set by the fourier analysis. At the end of the analysis, it showed 307.434 m% mismatch between period begins and ends. ls this causing spectrum leakage? Thanks. ======================== Fourier Analysis `FOUR0' ======================== Fundamental frequency = 968.75 kHz. Fundamental period = 1.03226 us. Fourier components of V(net016) for the interval from 8.96774 us to 10 us: DC = 412.951 mV. Harm: Absolute Absolute Relative Relative Magnitude Phase Magnitude Phase 1: 412.944 mV -95.4565 Deg 0.000 dB 0 Deg <- normalizer 2: 245.753 uV -155.438 Deg -64.508 dB -59.9814 Deg 3: 154.551 uV -127.679 Deg -68.536 dB -32.2226 Deg 4: 136.333 uV 70.9494 Deg -69.626 dB 166.406 Deg 5: 167.488 uV 127.225 Deg -67.838 dB 222.682 Deg 6: 70.1281 uV 50.7072 Deg -75.400 dB 146.164 Deg 7: 143.164 uV -4.80259 Deg -69.201 dB 90.654 Deg 8: 85.7771 uV -167.751 Deg -73.650 dB -72.2944 Deg 9: 57.4369 uV 85.7145 Deg -77.134 dB 181.171 Deg 10: 58.2287 uV 58.7229 Deg -77.015 dB 154.179 Deg 11: 96.982 uV -140.591 Deg -72.584 dB -45.1347 Deg 12: 112.673 uV -151.425 Deg -71.281 dB -55.9682 Deg 13: 48.6384 uV -81.8236 Deg -78.578 dB 13.633 Deg 14: 73.3771 uV 139.605 Deg -75.007 dB 235.062 Deg 15: 95.3559 uV -131.078 Deg -72.731 dB -35.6217 Deg 16: 75.5083 uV -27.9219 Deg -74.758 dB 67.5347 Deg 17: 27.7394 uV 40.3701 Deg -83.456 dB 135.827 Deg 18: 10.836 uV 114.367 Deg -91.620 dB 209.823 Deg 19: 29.4197 uV 24.4814 Deg -82.945 dB 119.938 Deg 20: 75.3786 uV 78.4791 Deg -74.773 dB 173.936 Deg 21: 40.8751 uV 159.28 Deg -80.089 dB 254.737 Deg 22: 88.73 uV 12.2185 Deg -73.356 dB 107.675 Deg 23: 58.7199 uV 111.711 Deg -76.942 dB 207.168 Deg 24: 96.3994 uV -151.858 Deg -72.636 dB -56.4017 Deg 25: 65.5622 uV -14.3222 Deg -75.985 dB 81.1343 Deg 26: 56.5478 uV 63.265 Deg -77.270 dB 158.721 Deg 27: 110.388 uV -157.099 Deg -71.459 dB -61.6427 Deg 28: 87.8713 uV -56.0377 Deg -73.441 dB 39.4189 Deg 29: 127.44 uV 70.3307 Deg -70.212 dB 165.787 Deg 30: 193.419 uV 173.36 Deg -66.588 dB 268.817 Deg Total harmonic distortion = 138.224 m% (-57.1883 dB). RMS value of computed spectrum (excluding DC) = 412.945 mV. RMS value of computed spectrum (including DC) = 583.996 mV. Nonperiodicity (first/last point mismatch) = -1.26953 mV (-307.434 m%) sheldon wrote on May 23rd, 2007, 4:47am:
|
Title: Re: Fourier analysis and DFT compare Post by venki_vlsi on May 23rd, 2007, 6:30pm hi drive force, i too using the same method(fourier compnent in GUI) in calculating distortion. For Fs=125MHZ Nc=83,Ns=1024, i got Fin=10.1318Mhz Since my Nc=83,i have to run my simulation for 83 clcok cycles(83*(1/10.1318M=8.192u ) with trans=0 to 8.192us. I am getting good sfdr.but problem is with distortion and non periodic mismatch. any commnets on these how to improve. ======================== Fourier Analysis `FOUR1' ======================== Fundamental frequency = 10.1318 MHz. Fundamental period = 98.6991 ns. Fourier components of V(OU) for the interval from 8.0933 us to 8.192 us: DC = 495.933 mV. Harm: Absolute Absolute Relative Relative Magnitude Phase Magnitude Phase 1: 494.736 mV -105.375 Deg 0.000 dB 0 Deg <- normalizer 2: 4.28339 mV -174.911 Deg -41.252 dB -69.5364 Deg 3: 5.55389 mV 178.646 Deg -38.996 dB 284.021 Deg 4: 5.43339 mV -170.83 Deg -39.186 dB -65.4553 Deg 5: 5.19213 mV -171.569 Deg -39.581 dB -66.1937 Deg 6: 5.68695 mV -168.216 Deg -38.790 dB -62.8415 Deg 7: 6.41957 mV -166.124 Deg -37.737 dB -60.7492 Deg 8: 7.52246 mV -160.438 Deg -36.360 dB -55.0634 Deg 9: 9.12129 mV -158.374 Deg -34.686 dB -52.9991 Deg Total harmonic distortion = 3.61018 % (-28.8494 dB). RMS value of computed spectrum (excluding DC) = 495.058 mV. RMS value of computed spectrum (including DC) = 700.737 mV. Nonperiodicity (first/last point mismatch) = 78.125 mV (15.7913 %). Total time required for tran analysis `tran' was 1.18 s. finalTimeOP: writing operating point information to rawfile. |
Title: Re: Fourier analysis and DFT compare Post by driveforce on May 23rd, 2007, 9:59pm Hi, venki_vlsi, Why did you get 15.7913% mismatch? Did you using real circuit or ideal block? By the way, Fin = 10.1318MHz may not be accurate enough for your calculation. venki_vlsi wrote on May 23rd, 2007, 6:30pm:
|
Title: Re: Fourier analysis and DFT compare Post by venki_vlsi on May 23rd, 2007, 10:23pm hi .. its for actual ckt only. Can u plz tell me how to improve non-periodic mismatch. I tired to improve distortion to 44 db not more than that.my spec is 55 db. |
Title: Re: Fourier analysis and DFT compare Post by driveforce on May 24th, 2007, 12:00am What is your clock frequency? I ran a simulation with fclk = 125MHz, fin = 10.1318MHz. The fourier analysis shows no periodic mismatch. ======================== Fourier Analysis `FOUR0' ======================== Fundamental frequency = 10.1318 MHz. Fundamental period = 98.6991 ns. Fourier components of V(net016) for the interval from 9.9013 us to 10 us: DC = 413.282 mV. Harm: Absolute Absolute Relative Relative Magnitude Phase Magnitude Phase 1: 409.473 mV -104.721 Deg 0.000 dB 0 Deg <- normalizer 2: 660.32 uV 155.756 Deg -55.849 dB 260.477 Deg 3: 387.222 uV 32.5348 Deg -60.485 dB 137.256 Deg 4: 544.762 uV -81.4079 Deg -57.520 dB 23.3131 Deg 5: 706.288 uV -167.658 Deg -55.265 dB -62.9373 Deg 6: 1.01321 mV 88.3409 Deg -52.131 dB 193.062 Deg 7: 988.561 uV -16.361 Deg -52.344 dB 88.36 Deg 8: 1.39653 mV -119.413 Deg -49.344 dB -14.6925 Deg 9: 2.32906 mV 132.577 Deg -44.901 dB 237.299 Deg Total harmonic distortion = 801.097 m% (-41.9263 dB). RMS value of computed spectrum (excluding DC) = 409.487 mV. RMS value of computed spectrum (including DC) = 581.792 mV. Nonperiodicity (first/last point mismatch) = 0 V (0 %) [quote author=venki_vlsi link=1179729208/0#3 date=1179970201]hi drive force, i too using the same method(fourier compnent in GUI) in calculating distortion. For Fs=125MHZ Nc=83,Ns=1024, i got Fin=10.1318Mhz Since my Nc=83,i have to run my simulation for 83 clcok cycles(83*(1/10.1318M=8.192u ) with trans=0 to 8.192us. I am getting good sfdr.but problem is with distortion and non periodic mismatch. any commnets on these how to improve. |
Title: Re: Fourier analysis and DFT compare Post by venki_vlsi on May 24th, 2007, 12:18am hi Drive force. Thanks a lot. What is simulation time?I ran from 0-8.192us..Its basically 83 intergercycles. Its looks u run more than 83 cycles from dats u have copied. How r u choosing simulation time? regards venkats |
Title: Re: Fourier analysis and DFT compare Post by driveforce on May 24th, 2007, 12:46am at first, I ran simulation with ideal blocks. The simulation time is 10us. For your case, real circuits, you may want to run more than 10us, since it need some time to settle down. Maybe that's the reason you had periodic mismatch. But no matter how long the simulation time, fourier analysis automatically chooses the last fundamental period to do calculation. Again, what is your clock frequency? |
Title: Re: Fourier analysis and DFT compare Post by venki_vlsi on May 24th, 2007, 1:07am Hi, My clock frequency is 125Mhz. I understood where i went wrong. previously i tried with dc voltage of 1.65 and amplitude of 1.65 to input sinewave so,i am getting nonperiodic mismatch. now i tried with dc voltage of 0 and amplitude of 3.3v,i am not getting any non periodic mimsmatch but distortion is less when compared with previous case. sorry for my english. thanks driveforce. |
Title: Re: Fourier analysis and DFT compare Post by sheldon on May 24th, 2007, 3:25am Venki, Not sure that the dc level matters since the Fourier component accounts for it. Here is the setup for your case. NOTE: To avoid accuracy issues, my testbench uses design variables: numPoints --> number of points in the FFT, 1024 tones --> input signal tone, 83 fsample --> sample rate, 125M so the Fourier component fundamental frequency ==> fsample/numPoints number of harmonics ==> numPoints/2 normharm ==> tone This minimizes setup since all the variables are controlled from ADE, makes the testbench re-usable, and eliminates the accuracy issue. Best Regards, Sheldon |
Title: Re: Fourier analysis and DFT compare Post by driveforce on May 24th, 2007, 11:35am Sheldon, I understand what your normharm means now. But I couldn't find where to set it. My Fouier analysis always takes fundamental frequency as normalizer. Here is the what I found in the netlist. FOUR0 (net016 0) fourier fund=125M/1024 points=300 active=yes order=2 \ harms=512 refharms=83 scale=1 and the analysis print out likes this: ======================== Fourier Analysis `FOUR0' ======================== Fundamental frequency = 122.07 kHz. Fundamental period = 8.192 us. Fourier components of V(net016) for the interval from 1.808 us to 10 us: DC = 412.985 mV. Harm: Absolute Absolute Relative Relative Magnitude Phase Magnitude Phase 1: 24.0204 uV -28.2579 Deg 0.000 dB 0 Deg <- normalizer 2: 12.7912 uV -122.369 Deg -5.473 dB -94.1112 Deg 3: 32.1999 uV -170.419 Deg 2.545 dB -142.161 Deg 4: 23.918 uV 42.1886 Deg -0.037 dB 70.4465 Deg .... 81: 37.8771 uV 98.2271 Deg 3.956 dB 126.485 Deg 82: 48.8834 uV -54.2941 Deg 6.172 dB -26.0361 Deg 83: 409.158 mV -104.695 Deg 84.626 dB -76.4374 Deg 84: 24.6046 uV 76.1291 Deg 0.209 dB 104.387 Deg 85: 46.3879 uV -93.9173 Deg 5.716 dB -65.6594 Deg .... 2nd question, how do you plot the fourier analysis output. It is only printed out into the output.log file. 3rd question, how do you use the window function? I only know the window function is availbe if I do FFT. Thanks a lot! |
Title: Re: Fourier analysis and DFT compare Post by venki_vlsi on May 24th, 2007, 7:40pm hi.. i too have used same test bench but we differ in giving values to fourier component. can u clear me doubts in ur fourier component setup. 1.fundamental frequency ==> fsample/numPoints. (I have given fin(10.1318Mhz) as fundemental frequency in fourier component.can u plz clear me why we should we use fundemental as fsample/number of points). 2.number of harmonics ==> numPoints/2 (i have not mentioned any hormonic number in fourier component.its default showing 10 hormonics.I feel higher order hormonics doesnt effect much.Should we take 512 as default number in fourier componenet). 3.rmharm ==> tone ( i have not mentioned any refernce hormonic as i didnt understood what it means. can u give me little more details). i too have done simulation with ur setup and results r getting differed.can u plz have a look. ======================== Fourier Analysis `FOUR1' ======================== Fundamental frequency = 122.07 kHz. Fundamental period = 8.19202 us. Fourier components of V(OU) for the interval from 1.80798 us to 10 us: DC = 498.416 mV. Harm: Absolute Absolute Relative Relative Magnitude Phase Magnitude Phase 1: 19.2405 uV -4.53968 Deg 0.000 dB 0 Deg <- normalizer 2: 8.87069 uV -151.694 Deg -6.725 dB -147.154 Deg 3: 64.5489 uV 96.2625 Deg 10.513 dB 100.802 Deg 4: 9.9571 uV -112.919 Deg -5.722 dB -108.38 Deg ...... 508: 39.9502 uV 18.8854 Deg 6.346 dB 23.4251 Deg 509: 75.2377 uV -160.875 Deg 11.844 dB -156.335 Deg 510: 14.0832 uV 127.099 Deg -2.710 dB 131.639 Deg 511: 8.52414 uV -68.0349 Deg -7.071 dB -63.4953 Deg 512: 5.03811 uV 162.856 Deg -11.639 dB 167.395 Deg Total harmonic distortion = 2.5702 M% (88.1994 dB). RMS value of computed spectrum (excluding DC) = 494.52 mV. RMS value of computed spectrum (including DC) = 702.117 mV. Nonperiodicity (first/last point mismatch) = 0 V (0 %). if u observe clearly my normaliser point is at 1st hormonic and ur normaliser point is at 83 hormonic.How ru able to acheive at that point) these results r with setup as shown in fig. Thanks and regards venkat sheldon wrote on May 24th, 2007, 3:25am:
|
Title: Re: Fourier analysis and DFT compare Post by driveforce on May 24th, 2007, 11:18pm Hi, venki, you should look at tone 83, which is your signal position, and your signal's harmonics are at 83x2, 83x3.... Sheldon's idea is very clever. setting fundamental equal to fsample gives long window (8.192u), which is also what you want. regards, driveforce |
Title: Re: Fourier analysis and DFT compare Post by venki_vlsi on May 27th, 2007, 9:29pm hi sheldon and driveforce can u tell me how u have got normaliser point is at 83rd hormonic while i got it at 1st hormonic. fourier component results r shown below. ======================== Fourier Analysis `FOUR1' ======================== Fundamental frequency = 122.07 kHz. Fundamental period = 8.19202 us. Fourier components of V(OU) for the interval from 1.80798 us to 10 us: DC = 498.416 mV. Harm: Absolute Absolute Relative Relative Magnitude Phase Magnitude Phase 1: 19.2405 uV -4.53968 Deg 0.000 dB 0 Deg <- normalizer 2: 8.87069 uV -151.694 Deg -6.725 dB -147.154 Deg 3: 64.5489 uV 96.2625 Deg 10.513 dB 100.802 Deg 4: 9.9571 uV -112.919 Deg -5.722 dB -108.38 Deg ...... 508: 39.9502 uV 18.8854 Deg 6.346 dB 23.4251 Deg 509: 75.2377 uV -160.875 Deg 11.844 dB -156.335 Deg 510: 14.0832 uV 127.099 Deg -2.710 dB 131.639 Deg 511: 8.52414 uV -68.0349 Deg -7.071 dB -63.4953 Deg 512: 5.03811 uV 162.856 Deg -11.639 dB 167.395 Deg Total harmonic distortion = 2.5702 M% (88.1994 dB). RMS value of computed spectrum (excluding DC) = 494.52 mV. RMS value of computed spectrum (including DC) = 702.117 mV. Nonperiodicity (first/last point mismatch) = 0 V (0 %). regards venkats |
Title: Re: Fourier analysis and DFT compare Post by venki_vlsi on May 30th, 2007, 5:43pm hi driveforce and seldon. I got result what i want. I too added normharm in CDF and extracted the result. Thanks Regards venkats |
Title: Re: Fourier analysis and DFT compare Post by ywguo on May 31st, 2007, 7:01pm Hello, The fourier component must have voltage input. Am I right? Is it feasible to do fourier analysis for a current? I tried the following method in a spectre netlist, but it reported fatal error. FOUR0 (I0:OUT_QN I0:OUT_QP) fourier fund=122.0703125K harms=4096 normharm=9 The error information in output log is shown below. Error found by spectre during circuit read-in. "input.scs" 2249: No master specified for instance 'FOUR0' "input.scs" 2249: Unexpected signal or attribute name "I0:OUT_QN". Expected end of file or end of line. Thanks Yawei |
Title: Re: Fourier analysis and DFT compare Post by venki_vlsi on May 31st, 2007, 10:56pm hi, I didn't try with current node as input. Please keep posting messages if u got any new ideas on dac (measuring mismatch, modelling ..etc)and i too will do the same. regards venkats |
Title: Re: Fourier analysis and DFT compare Post by RobertZ on Jun 4th, 2007, 12:17pm hi, yawei, Check this out. insert a vdc = 0 into the branch you want to measure. use a cvvs, and put fourier at cvvs output. This doesn't load your circuti at all. regards, Robert ywguo wrote on May 31st, 2007, 7:01pm:
|
Title: Re: Fourier analysis and DFT compare Post by Ken Kundert on Jun 4th, 2007, 2:12pm The fourier analysis component will directly analyze a current waveform if you use the term or refterm parameters. See spectre -h fourier for more information. -Ken |
Title: Re: Fourier analysis and DFT compare Post by ywguo on Jun 4th, 2007, 7:41pm Hi, Rorbert, Quote:
Good idea. I will try your method. Thank you. Yawei |
Title: Re: Fourier analysis and DFT compare Post by ywguo on Jun 4th, 2007, 7:53pm Ken, Ken Kundert wrote on Jun 4th, 2007, 2:12pm:
The help on fourier is not very clear, which is shown below. Instance Definition Name [p] [n] [pr] [nr] ModelName parameter=value ... Name [p] [n] [pr] [nr] fourier parameter=value ... The signal between terminals p and n is the test or numerator signal. The signal between terminals pr and nr is the reference or denominator signal. Fourier analysis is performed on terminal currents by specifying the term or refterm parameters. If both term and p or n are specified, then the terminal current becomes the numerator and the node voltages become the denominator. By mixing voltages and currents, it is possible to compute large signal immittances. Does the instance definition look like the following? Name fourier fund=122.0703125K harms=4096 normharm=9 term=I0:OUTP term=I0:OUTN, where I0 is a current-steering DAC, OUTP and OUTN are plus/minus current outputs. However, I doubt that the parameter term supports differential current signals. Thank you very much. Yawei |
Title: Re: Fourier analysis and DFT compare Post by ywguo on Jun 11th, 2007, 1:02am Hi, Ken, The parameter term and refterm don't support differetial current. So I do fourier integral using the method proposed by Robert, which put CCVS sources to convert currents to voltages. I remember that you have mentioned that equally spaced time steps reduce the error of fourier. However, I cannot find that post again. To reduce the interpolation error, I set the max step as 1 ps, a little smaller than the minimum step in the last output log. The simulation is running, much slower than before. Is it necessary? Or is it a good solution? Thanks Yawei |
Title: Re: Fourier analysis and DFT compare Post by boe on Jun 11th, 2007, 9:31am ywguo wrote on Jun 11th, 2007, 1:02am:
The Fourier transform uses equally spaced samples to calculate the harmonics; if you do not have a point at the required time, the simulator does linear interpolation and this may be too inaccurate (especially for low-distortion systems). If you limit the time step to 1 ps, you will be very slow, calculating at least 8M points for your 8 us simulation time, which is much more than you are likely to need... I use the strobeperiod option of Spectre (set to 1/fsample) whenever I have to do a Fourier analysis to get samples that are correctly spaced for the Fourier analysis and run the Fourier transform as post-processing job over my data. OK, then you need to calculate all the parameters for yourself, but you also know what you get. :-) BOE |
Title: Re: Fourier analysis and DFT compare Post by ywguo on Jun 11th, 2007, 7:22pm Hi, BOE, Quote:
Do you mean that you run a DFT function in the calculator? In spectre user guide, it reads that You can also dramatically improve the accuracy of external Fast Fourier Transform (FFT) routines. I think that means the parameter strobeperiod improves the accuracy of DFT function. However, I am runing a transient simulation with a FOUR component from analogLib, which is a fourier integral immediately after the transient simulation. Now the FOUR (fourier integral) result is much larger than that of DFT function at high frequency. I want to know whether the FOUR result have large error due to intepolation error. Then I run a simulation with maxstep = 1ps. Now the simulation speed is unacceptable slow. :( Thank you. Yawei |
Title: Re: Fourier analysis and DFT compare Post by boe on Jun 12th, 2007, 3:59am Hi, Yawei, ywguo wrote on Jun 11th, 2007, 7:22pm:
Yes. ywguo wrote on Jun 11th, 2007, 7:22pm:
The DFT is sensitive to the accuracy of the samples used - so you use strobeperiod to force the simulator to produce exactly the time points you need and therefore eliminating the interpolation error. ywguo wrote on Jun 11th, 2007, 7:22pm:
Spectre uses a quadratic numerical integration algorithm to calculate the Fourier integrals for the requested frequency points (cf. Spectre User Guide). To get reasonable results for high frequencies, you will probably need small time steps. Unfortunately, Cadence tells you hardly anything about the algorithm (which is why I prefer the DFT method), but I suggest a minimum of 10 or 20 points per period (of your harmonic), i.e. maxstep = 0.05/f ... 0.1/f. Did you try the suggestion of the Spectre User Guide ("If you are concerned about accuracy, perform an additional Fourier transform on a pure sinusoid generated by an independent source")? If you want to check harmonics, you might want to use a triangle wave (with you fundamental frequency). BOE |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |