Hi, I've been told Autoregressive Process (AR) offers better frequency resolution than classic Periodogram methods. So I used an example available in the MATLAB manual and compared with Periodogram. Results showed that Periodogram had better frequency resolution than AR via Burg method. I also studied pyulear, pcov, pmcov, their spectral looks almost identical. I've two questions. 1. Why my Periodogram has better frequency resolution than AR-based methods? 2. Have you experienced very similar spectrum in your data analysis? Thank you all, Cheers ----------Code---------------------- randn('state',0) fs = 1000; % Sampling frequency t = (0:fs)/fs; % One second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); % [P1,f] = pwelch(xn,hamming(256),128,1024,fs); [P1,f] = periodogram(xn,rectwin(length(xn)),1024,fs); [P2,f] = pburg(xn,14,1024,fs); plot(f,10*log10(P1),'r-',f,10*log10(P2),'b--'); grid legend('Periodogram','AR-Burg') ylabel('PSD Estimates (dB/Hz)'); xlabel('Frequency (Hz)');

0 |

8/7/2010 10:56:03 PM

On Aug 7, 3:56=A0pm, "Dean " <jiangwei0...@gmail.com> wrote: > Hi, I've been told Autoregressive Process (AR) offers better frequency re= solution than classic Periodogram methods. > ... Perhaps you have rediscovered a quaint historical artifact that a number of algorithms commonly labeled "high resolution" should have been labeled "high SNR only". Dale B. Dalrymple

0 |

8/8/2010 12:37:13 AM

dbd <dbd@ieee.org> wrote in message <c855b29e-c1e0-447d-a6d4-8a6ac14dbffe@m35g2000prn.googlegroups.com>... > On Aug 7, 3:56 pm, "Dean " <jiangwei0...@gmail.com> wrote: > > Hi, I've been told Autoregressive Process (AR) offers better frequency resolution than classic Periodogram methods. > > ... > > Perhaps you have rediscovered a quaint historical artifact that a > number of algorithms commonly labeled "high resolution" should have > been labeled "high SNR only". > > Dale B. Dalrymple Hi Dale, I also found all these AR methods, such as Burg, Covariance, YW, Modified Covariance actually producing almost visually identical spectrum (even with noise added). Is that something textbook won't tell me? Cheers, Dean

0 |

8/8/2010 3:14:06 PM

"Dean " <jiangwei0515@gmail.com> wrote in message <i3koa2$2nv$1@fred.mathworks.com>... > Hi, I've been told Autoregressive Process (AR) offers better frequency resolution than classic Periodogram methods. > > So I used an example available in the MATLAB manual and compared with Periodogram. Results showed that Periodogram had better frequency resolution than AR via Burg method. > > I also studied pyulear, pcov, pmcov, their spectral looks almost identical. I've two questions. > 1. Why my Periodogram has better frequency resolution than AR-based methods? > 2. Have you experienced very similar spectrum in your data analysis? > > Thank you all, > Cheers > ----------Code---------------------- > randn('state',0) > fs = 1000; % Sampling frequency > t = (0:fs)/fs; % One second worth of samples > A = [1 2]; % Sinusoid amplitudes > f = [150;140]; % Sinusoid frequencies > xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); > % [P1,f] = pwelch(xn,hamming(256),128,1024,fs); > [P1,f] = periodogram(xn,rectwin(length(xn)),1024,fs); > [P2,f] = pburg(xn,14,1024,fs); > plot(f,10*log10(P1),'r-',f,10*log10(P2),'b--'); grid > legend('Periodogram','AR-Burg') > ylabel('PSD Estimates (dB/Hz)'); > xlabel('Frequency (Hz)'); Hi Dean, Typically resolution improvements with AR methods for sinusoids are seen with short data records. So for example: reset(RandStream.getDefaultStream); fs = 1000; t = (0:fs/15)/fs; A = [2 1]; f = [140;150]; xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); hburg = spectrum.burg(24); psd(hburg,xn,'Fs',fs); hper = spectrum.periodogram; figure; psd(hper,xn,'Fs',fs); Note how the AR estimate resolves the two peaks, but the periodogram smears them together because they are closer than 14.92 hertz resolution of the periodogram (in this case). Don't get me wrong, I'm a big fan of nonparametric methods and have used them much more frequently than parametric methods (which have their own issues), but the resolution superiority is usually brought up in the context of short data records. Of course, if you overmodel the data using parametric methods, you can get line splitting where one true sinusoid gets split into two separate ones. Kinda the opposite problem :) Also, there are the so-called superresolution methods, which begin with a signal model that is a superposition of complex exponentials plus noise. These methods decompose the autocorrelation matrix into a signal subspace and a noise subspace. They don't yield a PSD estimate, so they're used when you want to estimate frequencies, see spectrum.music and spectrum.eigenvector for examples in MATLAB. Wayne

0 |

8/8/2010 3:32:07 PM

On 8 Aug, 00:56, "Dean " <jiangwei0...@gmail.com> wrote: > Hi, I've been told Autoregressive Process (AR) offers better frequency resolution than classic Periodogram methods. Don't believe what people tell you. There are plenty people around who tell you all sort of stuff, that they - when challenged - turn out to know nothing whatsoever about. The AR methods don't provide frequency resolution. They characterize the covariance structure of the signal in terms of an AR model. The good part about this is that you can get good characteristics with small ampunts of data (a novice or amateur might interpret this as 'better frequency resolution'). The downside is that the charactersitics might not be easily interpreted. The really bad side is that if the the data do not comply to the assumed model (AR in this case), the computed parameters might not make sense at all. Rune

0 |

8/8/2010 5:29:37 PM

Hi All, Thank you for all your comments, really useful and encouraging. I feel I also like classic non-parametric ones better than AR methods. To my understanding, the model order P should be selected equivalent to 2*number of sinusoidal assuming in an ideal case. However, I got an error message like shown. The signal is synthesized without noise added. I don't understand what makes matlab think I should use smaller P? Of course, I will never see three peaks for P=4. Cheers, Dean ----------Error Message --------------------------------- ??? Error using ==> arspectra at 87 The variance estimate of the white noise input to the AR model is negative. Try to lower the order of the AR model. ----------END of Error Message ---------------------- -------------Code------------------------------------------- reset(RandStream.getDefaultStream); fs = 1000; t = (0:fs/15)/fs; A = [2 1 1]; f = [140;150;155]; xn = A*sin(2*pi*f*t); [Pxx_cov,f]=pcov(xn,6,2048,fs);

0 |

8/8/2010 5:50:08 PM

"Dean " <jiangwei0515@gmail.com> wrote in message <i3mqog$j8q$1@fred.mathworks.com>... > Hi All, > > Thank you for all your comments, really useful and encouraging. > > I feel I also like classic non-parametric ones better than AR methods. > > To my understanding, the model order P should be selected equivalent to 2*number of sinusoidal assuming in an ideal case. However, I got an error message like shown. > > The signal is synthesized without noise added. I don't understand what makes matlab think I should use smaller P? Of course, I will never see three peaks for P=4. > > Cheers, > > Dean > > ----------Error Message --------------------------------- > ??? Error using ==> arspectra at 87 > The variance estimate of the white noise input to the AR model is negative. Try to lower the order of the AR model. > ----------END of Error Message ---------------------- > > > > -------------Code------------------------------------------- > reset(RandStream.getDefaultStream); > fs = 1000; > t = (0:fs/15)/fs; > A = [2 1 1]; > f = [140;150;155]; > xn = A*sin(2*pi*f*t); > [Pxx_cov,f]=pcov(xn,6,2048,fs); Hi Dean, Fitting an AR(p) models explicitly models the output, y(n), as y(n)-a(1)y(n-1)-a(2)y(n-2)- a(p)y(n-p)=e(n) where e(n) is white noise. There should be a white noise input. To be fair to AR spectral methods, they do have a lot of important uses. There are applications where the physical nature of the signal generation mechanism makes an AR model a good a priori choice. If you look at human speech analysis, you find a number of applications where AR models are quite useful. It just so happens that the things I've used spectral analysis for, nonparametric methods have been more appropriate. Another thing you might find interesting about AR processes given your other posts, AR processes have nice closed-form expressions for their PSDs. Therefore, you can generate a realization of an AR process, determine its true PSD, and then test spectral estimators against it. Note for the example the use of an AR(4) process to illustrate the problem of bias in the periodogram: reset(RandStream.getDefaultStream); x = randn(1024,1); %AR(4) Process A = [1 -2.7670 3.8106 -2.65335 0.9238]; y = filter(1,A,x); sigma = 1; f =0:(1/length(x)):0.5; tmp = zeros(length(2:length(A)),length(f)); for k = 2:length(A) tmp(k-1,:) = A(k)*exp(-1j*(k-1)*2*pi*f); end tmp = sum(tmp); denom = abs(1+tmp).^2; psdtrue = sigma^2./denom; h = spectrum.periodogram; psdest = psd(h,y,'Fs',1,'NFFT',length(x)); figure; plot(f,10*log10(psdest.Data)); hold on; plot(f,10*log10(psdtrue),'r','linewidth',2); See how the periodogram blows the estimate above about 0.2 Hz? That is a demonstration of the known bias effect in the periodogram. Note how the use of a Hamming window alleviates that problem. hwin = spectrum.periodogram('Hamming'); psdwin = psd(hwin,y,'Fs',1,'NFFT',length(x)); figure; plot(f,10*log10(psdtrue),'r','linewidth',2); hold on; plot(f,10*log10(psdwin.Data)); Wayne

0 |

8/8/2010 8:07:07 PM

On 8 Aug, 19:50, "Dean " <jiangwei0...@gmail.com> wrote: > Hi All, > > Thank you for all your comments, really useful and encouraging. > > I feel I also like classic non-parametric ones better than AR methods. Agreed. Better than that: There exists a scientific argument to support that subjective feeling. See below. > To my understanding, the model order P should be selected equivalent to 2*number of sinusoidal assuming in an ideal case. Yep indeed! Congratulations! You are one of the extremely few who are able to figure that one out on your own! Seriously. For once none of my irony or sarcasm; merely sheer joy and happiness that somebody are able to actually figure this one out. Yes, the model order is the CATCH 22 of DSP. The feasible range of model orders depends on the number data points available (the exact details depend on the method in use). For simplicity, say P = N/2 where N is the number of data points and P is the maximum allowable order. Denote the *true* number of sinusoidals as D. For the AR-type predictors to work, D < P. If one uses the Levinson recursion one can estimate D on the fly, using some sort of order estimator. If one contemplates this, one finds that one necessary criterion for AR-type methods to work, is that the relation D < P = N/2 holds. In other words, the designer / analyst who configures the AR-type methods can not choose N arbitrarily, but must know in advance what scenario he is working in. Feed the method too few data points and one ends up with D >= N/2 and the method unconditionally breaks down. Just try it. Use N = 12 data points, no noise, and try and feed the AR method first data from an AR(1) process, then and AR(2), then AR(3), and so on. With the 'usual' model, you will be able to recover the AR parameters (possibly with errors due to estimator bias) for models up to and including AR(5).From AR(6) and beyond, the computations need not make any sense at all. All this forms the argument in support of non-parametric methods: They might not produce the best results, but they have no such Achilles heels either. The non-parametrics work where the parametrics break down. Rune

0 |

8/9/2010 8:07:01 AM

On Aug 8, 10:50=A0am, "Dean " <jiangwei0...@gmail.com> wrote: > Hi All, > > Thank you for all your comments, really useful and encouraging. > > I feel I also like classic non-parametric ones better than AR methods. > > ... > Dean The classical non-parametric method for tones is really a two part process. First the peaks of the periodogram and then an interpolation method applied to the dft coefficients about the peaks. See: D. C. Rife, and R. R. Boorstyn, =93Single tone parameter estimation from discrete-time observations,=94 IEEE Trans. Inform. Theory, vol. IT-20, pp591-598, 1974 D. C. Rife, and R. R. Boorstyn, =93Multiple tone parameter estimation from discrete-time observations,=94 Bell Sysr. Tech. J., vol. 55, pp. 1389-1410, 1976. The stationary tone case has been frequently presented in the IEEE Trans on Instrumentation and Measurement: http://wwwtw.vub.ac.be/elec/Papers%20on%20web/Papers/JohanSchoukens/IM92Sch= oukens-The%20Interpolated.pdf For the non-stationary case, one of the approaches can be found under the label "frequency reasignment", for example: http://perso.ens-lyon.fr/patrick.flandrin/0065-Ch05.pdf Anyone who limits their comparisons to non-parametric techniques to peak-picking the periodogram is either uninformed or intentionally misleading. You can find both in the literature. Dale B. Dalrymple

0 |

8/9/2010 6:00:17 PM

Hi all, I have a database with following fields : field1 price01 color01 price02 color02 . . . price40 color40 What i am trying to do is : Creating the bdatacolumn in an iterative procedure : For nMnr = 1 To 40 sSymbnam := AsSymbol(oDet_Serv:FieldName((nMnr) * 2)) creating bdatacolumn for field pricexy via sSymbnam sSymbnam := AsSymbol(oDet_Serv:FieldName((nMnr * 2) + 1)) creating bdatacolumn for field colorxy via sSymbnam for the fields colorxy I want following color condition: oColorCondition := bColorCondition{"Server:Che...

Greetings, Title: SAP FI Consultant (AP, AR, GL) Location: LA,California Duration: 12+ months Start Date: ASAP # of positions: 1 Description/ Required Experience: Senior SAP FI Consultant needed to assist in a global rollout of SAP ECC. The consultant will need to have experience working with intercompany accounting, global accounting standards, taxes (US and VAT), FASB52 (Currency conversions),SAP HCM integration, LIV (Logistics Invoice Verification), etc. Warm regards, Robert Gordon Ideavate Solutions Tel: 732-654-9068 Email: robert.gordon@ideavate.com www.ideavate.com ...

In the code at our company i see the following. if (someStuff !=3D null) { if (someStuff !=3D "") { doThatThing (); } } While it's fully correct and valid, i'd like to rewrite it as follows. if (someStuff !=3D null && someStuff !=3D "") doThatThing (); I know that some languages will evaluate the first condition of the conjunction and, provided that it fails, conclude that the statement is not to be performed. I'd like to assume so in this case as well, but wishing not to show arrogance and know-better-ism, i'd like to check with mo...

Hi The FFT famous butterfly, involves the following calculations: (1) A' = A + B*W (2) B' = A - B*W I am going to implement a 32-bit FFT on a 16-bit machine, i.e. it can perform 16bit X 16bit -> 32bit. For doing that, a 32bit X 32bit -> 64bit multiplication needs to be performed by four 16bit X 16bit -> 32bit operations and then adding & shifting four products in order to have a correct 64bit result. That is, all intermediate calculations would be done in 64-bit resolution in order to maintain highest accuracy. Finally, the result of each stage is only the upper 32-b...

US-MD-Rockville: Peoplesoft Developer, Financials rel. 8.0, AR/GL/Billing, SQL; (45294057639) ============================================================================================= Position: Peoplesoft Developer Reference: SMC01296 Location: Rockville MD Duration: 3M Skills: This position is for a full-time ON-SITE developer on the CLIENT Account in Rockville, MD. The person will report to the Corporate Tower PeopleSoft Project Manager. This position will assist in the maintenance, enhancements, and ...

as has been pointed, shrub left the texas educaiton system in a shambles from which it will take years to recover. his 'policies' were a disaster there, and his federal policies are having similar effects on the us level. On Front Lines, Casualties By MICHAEL WINERIP I N 20 years as a public school administrator on the Upper West Side of Manhattan, Lawrence Lynch, the principal of Booker T. Washington Middle School on 107th Street, has never seen such a disastrous start to a school year. It is the third week and he still has many teachers with more than 40...

Folks Running Solaris 8, I need to know how to decompress an "ar file". The file is called REF and when I do > file REF I get REF: current ar archive, not a dynamic executable or shared object How do I get at the contents, tried tar and gunzip but not work. >> On Fri, 04 Mar 2005 15:08:32 GMT, >> "Rob" <gofyself@wrong.address.com> said: > Folks Running Solaris 8, I need to know how to decompress an > "ar file". The file is called REF and when I do >> file REF > I get > REF: current ar archive, not a dy...

Hello, I am creating a container. I have some types which are built to be members of the container. The members need to know which container they are in, as they call methods on it, such as finding other members. I want help with the syntax to create the members. Currently, the container has to be a parameter to the instantiation methods. I want the option to create members with attribute syntax instead. Currently, I have: cA= Container( ) obA= SomeType( cA ) obB= OtherType( cA, otherarg ) I want: cA= Container( ) obA= cA.SomeType( ) obB= cA.OtherType( otherarg ) What are my options?...

I hesitate to agree to the download process because it sounds like they are asking me permission to use my computer to help upload to other computers. This sounds like a bad idea to me. It would be borrowing bandwidth I pay for, and I also wonder if there may be security issues. 1. Is this truly what they are asking to do? 2. Am I being too paranoid? "Adam Russell" <adamrussell@sbcglobalREMOVETHIS.net> wrote in news:2ppckuFmor1vU1@uni-berlin.de: > I hesitate to agree to the download process because it sounds like > they are asking me permission to use my compute...

Hi, using Tkinter, on a Text widget i would like to place the cursor to a given position like the icursor() method of the Entry widget. Is it possible do that, if it is how please ? Thank You. snx7s wrote: > Hi, > > using Tkinter, on a Text widget i would like to place the cursor to a > given position like the icursor() method of the Entry widget. > Is it possible do that, if it is how please ? > > Thank You. Use text.mark_set(Tkinter.INSERT, "5.2") to move the cursor to column 2 in row 5, where columns start at 0 and the first line is 1. There are other ...

http://www.programmersguild.org/Guild/Humor.htm It's worth reading. I had heard some of them before but the new ones (and the old ones) gave me a chuckle "delusion" <mynewemailaddressitis@yahoo.co.uk> wrote in message news:e279b74b.0309071004.53ad46b3@posting.google.com... > http://www.programmersguild.org/Guild/Humor.htm Problem Solving Program 01 * 02 * Copyright 2003 Rocking Red � Imaginary Company Incorporated 03 * 04 * 09-08-03 Rocking Red - Set up as example 05 * 06 FALSE = 0 07 TRUE = 1 ...

I have a question concerning the way Matlab detect the right method to a method name. Let XXX be some class, with constructor XXX. Now I have defined an other class YYY and wrote an convert method XXX(yyy) that converts a YYY object yyy to an XXX object. This method I stored in th YYY class directory (@YYY). Following the help, MatLab should determine the type of yyy and therefore execute the method in the YYY directory. However it does not and executes the constructor! Why????? Hi Ralf, the method name should not be the class name of another class. Therefore: make your converter method XXX(...

Hey, i'm working on a project and i actually have an audio signal. After applying to it the fft() function,how can i find the index of the maximum fft value ,and transform it to (Hz) units? I'm a new user so... Thanks a lot. "Dimitris Valapetrou" <diastro@email.com> wrote in message <ht454i$g4r$1@fred.mathworks.com>... > Hey, > i'm working on a project and i actually have an audio signal. > After applying to it the fft() function,how can i find the index > of the maximum fft value ,and transform it to (Hz) units? > I'm a new user...

I wonder if anyone has tried AR (anti-reflective) coating on flatbeds? I have some glossy photos which cause Newton's rings when scanned. It occurred to me that applying AR coating to the scanner glass may help. So, has anyone tried this? If yes, what coating did you use and did it help? (I understand there is an AR spray.) Don. ...

Suppose development has marked Bug A as a duplicate of Bug B because the fixes for both entail the same code. Bug A has a different reproduction sequence and a slightly different result from Bug B. And It is not easily evident to the QA tester that the 2 bugs are caused by the same code logic. Is it reasonable to implement a policy that states such bugs should not be marked as duplicates? i.e., QA should track and resolve each bug seperately since QA has no knowledge of the internal code. ( QA will, of course, continue to strive to reduce the # of duplicate reports.) email: software...

I want to compare AR and AR-GARCH. First I simulate 1000 obs according to an AR-GARCH and then estimate AR and AR-GARCH and derive forecasts for 1001...1100. According to the mean squared forecast error the AR model is better, but the predicted trend looks strange because it should converge to something which it doesn't. maybe something is wrong with the forecasting step, the lags in particular. Also the sign of the AR estimation is negative although in the DGP it is positive. any ideas? Dirk %let var2 = 2.5; %let nobs = 1100 ; %let arch0 = 0.1 ; %let arch1 = 0.2 ; %let garch...

Hi guys, i have 2 classes say class A and class B. How can the A object that i'll create to call a class B method???? Say we have this code: class A def printA puts = "Class A method" end end class B def printB puts "Class B method" end end I want to make something like this: a = A.new a.printB I this possible someway??? I dont want to use modules. Thanx in advance Kostas L. -- Posted via http://www.ruby-forum.com/. On Monday 24 August 2009 05:12:44 pm Kostas Lps wrote: > I want to make something like this: > a = A.new > a.printB Use mo...

Hi all. I'm trying to develop an automated method of converting Access (97 or 2000) databases to SAS using DBMSCopy. I've discovered that there is not a rigid standard set to control the naming and number of tables in each database. Is there a batch method or utility that can extract the table names from an Access database ??? Thanks for your help.......Gordon --------------------------- Gordon Keeler, statistician Dept. of Psychiatry Duke University Med Center gkeeler@psych.duhs.duke.edu --------------------------- Gordon Keeler <gkeeler@psych.duhs.duke.edu> wrote in messag...

hello, I have a java bean and I made the bean as a dll using java packager. I can access the methods in VB and when I try to load a file, ie. set the path and the bean is trying to load, I get File permission error. Does anyone know how to resolve this?. In article <1106856549.893446.172140@z14g2000cwz.googlegroups.com>, refeekhm@yahoo.com wrote: > hello, > > I have a java bean and I made the bean as a dll using java packager. I > can access the methods in VB and when I try to load a file, ie. set the > path and the bean is trying to load, I get File permission error...

US-MD-Rockville: Peoplesoft Developer, Financials rel. 8.0, AR/GL/Billing, SQL; (45293457609) ============================================================================================= Position: Peoplesoft Developer Reference: SMC01296 Location: Rockville MD Duration: 3M Skills: This position is for a full-time ON-SITE developer on the CLIENT Account in Rockville, MD. The person will report to the Corporate Tower PeopleSoft Project Manager. This position will assist in the maintenance, enhancements, and ...

I just got the svn trunk and was testing some new stuff, but could not find the define_singleton_method: irb(main):001:0> [RUBY_VERSION,RUBY_RELEASE_DATE] => ["1.9.0", "2007-08-28"] irb(main):002:0> a = "" => "" irb(main):003:0> a.define_singleton_method(:foo){|x| x + 1} NoMethodError: undefined method `define_singleton_method' for "":String Running out of irc the same two lines above I get the same results: [taq@~/code/ruby/1.9]ruby1.9 dsm.rb dsm.rb:2:in `method_missing': undefined method `define_singleton_method'...

How does one use define_method to create a method that can take arguments? Is that possible? Wes -- Posted via http://www.ruby-forum.com/. Wes Gamble wrote: > How does one use define_method to create a method that can take > arguments? > > Is that possible? > > Wes > Use a block that has arguments: irb(main):003:0> class << self; define_method :foo do |x, *y| p x, y; end; end => #<Proc:0xb7ca3f20@(irb):3> irb(main):004:0> foo 1,2,3 1 [2, 3] => nil -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 Wes Gamble wrote...

I have never used replication before and I have been asked to consider it in a project I am currently working on. I have created an application for a sales team which is loaded on their machines, it uses ms sql as its data source and connects via the internet back to the central server in the office. Problem is this has shown to be too slow causing time out error messages and so on. I have been told to research the possibility of replication, but am unclear what type of replication to use or where to start. Any assistance would be appreciated. Regards, Ben bfausti@gmail.com wrote: >...

Hi all, I am trying to implement the phase-shift method, in order to calculate the = phase velocities of a seismic signal. Considering a seismic record in the time-offset domain u(t,x) containing th= e ground roll, the Fourier transform for each trace is expressed =20 U(x,=CF=89 ) =3D integral (u(x, t)e=04=05=06=07xp(-i=CF=89t) dt. The equation above could be rewritten as U(x,=CF=89)=3DP(x,=CF=89)A(x,=CF= =89) P(x,=CF=89) is the phase spectrum A(x,=CF=89) is the amplitude spectrum The amplitude spectrum contains all the information about attenuation and s= pherical divergenc...

Can anybody explain to me why this code: clear; clc; n = 1:40001; dt = 0.014; fs = 1/dt; df = fs/length(n); fl = 1/200; fh = 1/(2*dt); v0 = 0.25; phi = rand(1,3)*2*pi; M = 512; m = 1:8192; udesign = ((v0/M)*(cos(2*pi*fl*(n-1)*dt+phi(1))))+((v0/M)*cos(2*pi*fl*4000*(n-1) *dt+phi(2)))+((v0/M)*cos(2*pi*fl*8000*(n-1)*dt+phi(3))); U = fft(udesign); plot(n(1:length(n)/2)*df,abs(U(1:length(n)/2))); does not produce the two peaks with the same magnitude in the frequency plot? The magnitude of the peak at about 33Hz is less than the one at 20Hz, yet they should have the same magnitude...I think Thanks...