DSPRelated.com
Forums

Question about DSP in Matlab (beginner)

Started by JCO_DSP May 23, 2015
[...snip...]
> >I don't think using a particular word to communicate something doesn't >have any indication about how well one might or might not understand a >topic. Your examples are good cases in point. I think most people >that I've worked with, and the vast majority of people who've been >contributors to comp.dsp, use the term "leakage" because everybody >knows what they mean by it. It doesn't mean that they think >something is "leaking" out of something else, it's just how it's >described. > >Likewise for the uncertainty principle. It's the same for most cases >where there is an "uncertainty principle". It's really just a way to >describe a limitation in the math, and many people understand this. >
Both are terribly misleading terms. I used them as well so people knew what I was talking about.
>Semantics is a big problem in many industries, and also in DSP. >There are a lot of overloaded terms and a lot of terms, like >"leakage", that people know what they mean despite it being an >imperfect word for the concept. >
Jargon is also often used for exclusionary purposes.
>If you think everyone who uses those terms doesn't understand the >underlying principles you're wrong. Sorry, you just are.
Understanding the underlying principles can be a behavioral statement. I don't doubt they do. Being able to describe it with a mathematical statement is another matter.
> >Repeating: >>Unless you can derive the equations in my blog article titled "DFT Bin >>Value Formulas for Pure Real Tones" (at dsprelated dot com), you don't >>understand leakage mathematically. Sorry, you don't. > >I think that's an incredibly arrogant statement. > >And, btw, other people have done derivations to the same purpose as >your article and come up with cleaner results. >
Thank you. I enjoy writing in the "authoritative voice". If you don't mind, could you provide some links for these derivations? rbj thought that the exact frequency formula had been solved, yet I showed him links to your frequency estimation page and the dspguru page, there was no such formula to be found, just estimators. No reply. [...snip...]
> >Eric Jacobsen >Anchor Hill Communications >http://www.anchorhill.com
Thanks for your reply. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Mon, 25 May 2015 14:19:35 -0500, "Cedron" <103185@DSPRelated>
wrote:

>[...snip...] >> >>I don't think using a particular word to communicate something doesn't >>have any indication about how well one might or might not understand a >>topic. Your examples are good cases in point. I think most people >>that I've worked with, and the vast majority of people who've been >>contributors to comp.dsp, use the term "leakage" because everybody >>knows what they mean by it. It doesn't mean that they think >>something is "leaking" out of something else, it's just how it's >>described. >> >>Likewise for the uncertainty principle. It's the same for most cases >>where there is an "uncertainty principle". It's really just a way to >>describe a limitation in the math, and many people understand this. >> > >Both are terribly misleading terms. I used them as well so people knew >what I was talking about. > > >>Semantics is a big problem in many industries, and also in DSP. >>There are a lot of overloaded terms and a lot of terms, like >>"leakage", that people know what they mean despite it being an >>imperfect word for the concept. >> > >Jargon is also often used for exclusionary purposes.
Is that how you use it?
>>If you think everyone who uses those terms doesn't understand the >>underlying principles you're wrong. Sorry, you just are. > >Understanding the underlying principles can be a behavioral statement. I >don't doubt they do. Being able to describe it with a mathematical >statement is another matter.
There are many ways to mathematically show where "leakage" comes from in the DSP context. Some are very straightfoward.
>> >>Repeating: >>>Unless you can derive the equations in my blog article titled "DFT Bin >>>Value Formulas for Pure Real Tones" (at dsprelated dot com), you don't >>>understand leakage mathematically. Sorry, you don't. >> >>I think that's an incredibly arrogant statement. >> >>And, btw, other people have done derivations to the same purpose as >>your article and come up with cleaner results. >> > >Thank you. I enjoy writing in the "authoritative voice".
>If you don't mind, could you provide some links for these derivations?
Look for papers by Cagatay Candan, and papers citing him.
>rbj thought that the exact frequency formula had been solved, yet I showed >him links to your frequency estimation page and the dspguru page, there >was no such formula to be found, just estimators. No reply. > >[...snip...] > >> >>Eric Jacobsen >>Anchor Hill Communications >>http://www.anchorhill.com > >Thanks for your reply. > >Ced >--------------------------------------- >Posted through http://www.DSPRelated.com
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
[...snip...]
>> >>Jargon is also often used for exclusionary purposes. > >Is that how you use it? >
No. I would like to see the terms replaced with something more meaningful, easier for beginners to grasp, and less dependent of "knowing what they really mean." [...snip...]
> >There are many ways to mathematically show where "leakage" comes from >in the DSP context. Some are very straightfoward. >
The most straightforward, in my opinion, is an understanding of linear algebra, and the DFT bins are really a set of coordinates in an orthonormal vector space. However, a pure tone within a DFT is a very specific case that allows for a more specific description. A different interpretation, which ignores the linear algebra interpretation completely is the one I present in my blog titled "DFT Graphical Interpretation: Centroids of Weighted Roots of Unity". This interpretation is not among those listed in the Wikipedia article on DFTs. I would consider it more behavioral than mathematical though. [...snip...]
>>>And, btw, other people have done derivations to the same purpose as >>>your article and come up with cleaner results. >>> >> >>Thank you. I enjoy writing in the "authoritative voice". > >>If you don't mind, could you provide some links for these derivations? > >Look for papers by Cagatay Candan, and papers citing him. >
Sorry, I'm not going on a wild goose chase. Either you can come up with a specific cite where a derivation with cleaner results is shown or I will consider your statement just a bunch of bluster. My equations are exact, so any other derivation has to lead to the same answer. Granted, there are trigonometric terms so the equations can take on different forms. I will be presenting some different forms myself in a future blog article to deal with the numerical instability in the neighborhood of integer frequencies.
>>rbj thought that the exact frequency formula had been solved, yet I >showed >>him links to your frequency estimation page and the dspguru page, >there >>was no such formula to be found, just estimators. No reply.
Ditto for an exact frequency formula. I've put up mine and told you right where it is. Here is a link: http://www.dsprelated.com/showarticle/773.php [...snip...]
>>--------------------------------------- >>Posted through http://www.DSPRelated.com > >Eric Jacobsen >Anchor Hill Communications >http://www.anchorhill.com
Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Mon, 25 May 2015 16:08:05 -0500, "Cedron" <103185@DSPRelated>
wrote:

>[...snip...] >>> >>>Jargon is also often used for exclusionary purposes. >> >>Is that how you use it? >> > >No. I would like to see the terms replaced with something more >meaningful, easier for beginners to grasp, and less dependent of "knowing >what they really mean."
I've never known a beginner to struggle with the concepts in question because of the terms used to describe them. In engineering there are far more egregious examples of poorly named concepts that are still handled well by students and practicioners. I think the ones in question are used because they're useful for the concepts. I kinda like them, but that's just me. It certainly doesn't hurt to have the clearest terms possible for things like this, but "clear" is in the eye or ear of the beholder.
>[...snip...] > >> >>There are many ways to mathematically show where "leakage" comes from >>in the DSP context. Some are very straightfoward. >> > >The most straightforward, in my opinion, is an understanding of linear >algebra, and the DFT bins are really a set of coordinates in an >orthonormal vector space. However, a pure tone within a DFT is a very >specific case that allows for a more specific description. > >A different interpretation, which ignores the linear algebra >interpretation completely is the one I present in my blog titled "DFT >Graphical Interpretation: Centroids of Weighted Roots of Unity". This >interpretation is not among those listed in the Wikipedia article on DFTs. > I would consider it more behavioral than mathematical though.
Or you can just take the FT of the transform window.
>[...snip...] > >>>>And, btw, other people have done derivations to the same purpose as >>>>your article and come up with cleaner results. >>>> >>> >>>Thank you. I enjoy writing in the "authoritative voice". >> >>>If you don't mind, could you provide some links for these derivations? >> >>Look for papers by Cagatay Candan, and papers citing him. >> > >Sorry, I'm not going on a wild goose chase. Either you can come up with a >specific cite where a derivation with cleaner results is shown or I will >consider your statement just a bunch of bluster. My equations are exact, >so any other derivation has to lead to the same answer. Granted, there >are trigonometric terms so the equations can take on different forms. I >will be presenting some different forms myself in a future blog article to >deal with the numerical instability in the neighborhood of integer >frequencies.
Uh, you're the one that asked for a link. In this business the name of an author for a topic usually gets you to easy search results. If you're not even willing to type in his name I'm certainly not going to do the work for you.
>>>rbj thought that the exact frequency formula had been solved, yet I >>showed >>>him links to your frequency estimation page and the dspguru page, >>there >>>was no such formula to be found, just estimators. No reply. > >Ditto for an exact frequency formula. I've put up mine and told you right >where it is. Here is a link: > >http://www.dsprelated.com/showarticle/773.php
I read it not long after you posted it on dsprelated. I just gave you the name of an author for relevant work. I have a spoon, but I'm not gonna feed you with it.
>[...snip...] > >>>--------------------------------------- >>>Posted through http://www.DSPRelated.com >> >>Eric Jacobsen >>Anchor Hill Communications >>http://www.anchorhill.com > >Ced >--------------------------------------- >Posted through http://www.DSPRelated.com
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Saturday, May 23, 2015 at 1:10:26 PM UTC-4, JCO_DSP wrote:
> Hi, > > I'm starting to learn DSP (Matlab )and I have two questions about it, > maybe someone can help me out? > > I'm trying to measure a frequency from an Audio Device and I'm using FFT > to transform it from the time domain to the frequency domain. But I am > doing a downsample before the FFT. But you can also do it after the FFT. > Do you know what would be the most efficient (before or after)? And why? > > Another question, I am using zero padding to increase my system resolution > (up to 50Hz). My frame length is N=256 and sample frequency fs= 44100 Hz. > So 44100/50 = 882, so I need to add 626 zeroes (to 256 frame length) to > get 50 Hz resolution, I hope this is correct? I believe this is done for > FFT. But is this the same for the DFT? > > Thank you and regards, > > > > --------------------------------------- > Posted through http://www.DSPRelated.com
Why on Earth would anyone use Fourier transform to measure the frequency of a simple audio signal ? And why do you think regular "experts" is this group are giving you correct answers ? Google is your friend: http://www.google.com/patents/US7124075 http://www.gamedev.ru/flame/forum/?id=134654
[...snip...]
>> >>No. I would like to see the terms replaced with something more >>meaningful, easier for beginners to grasp, and less dependent of >"knowing >>what they really mean." > >I've never known a beginner to struggle with the concepts in question >because of the terms used to describe them. In engineering there are >far more egregious examples of poorly named concepts that are still >handled well by students and practicioners. I think the ones in >question are used because they're useful for the concepts. I kinda >like them, but that's just me. > >It certainly doesn't hurt to have the clearest terms possible for >things like this, but "clear" is in the eye or ear of the beholder.
As I've said, I think they are terribly misleading. If you like them, so be it. I'm not going to argue about opinion. [...snip...]
>> >>>>>And, btw, other people have done derivations to the same purpose as >>>>>your article and come up with cleaner results.
This is still what I want to see. [...snip...]
> >Uh, you're the one that asked for a link. In this business the name >of an author for a topic usually gets you to easy search results. If >you're not even willing to type in his name I'm certainly not going to >do the work for you.
Yep, I asked you to back your assertion with a link, not an exercise in searching. [...snip...]
> >I read it not long after you posted it on dsprelated. I just gave >you the name of an author for relevant work. I have a spoon, but I'm >not gonna feed you with it. >
I'm not asking to be spoonfed, I'm asking for a citation. A citation is more detailed than just an author's name. I did do a search on his name and came up with a long list papers. I think it is rather arrogant of you to assume I should search through all of those when you supposedly know where the equations are. A lot of his papers were behind pay walls as well. I did find one on line that looked like it might be on topic. Something about Fine Resolution Frequency Estimation with 3 DFT bins. I opened it and scanned it briefly. I did not find any bin value formulas and the other equations were no where near as "clean" as mine. As soon as I saw the first little squiggly equal sign in his derivation, game over, he's not exact any more. What would be even better would be for you to type in the formulas in a response. If they are cleaner than mine, this shouldn't be too much effort. Here are mine for those who haven't read my article, and to demonstrate how easy they are to type in. S_k = M cos( f 2 pi / N + phi ) defines the signal Let alpha = f 2 pi / N Let beta_n = n 2 pi / N Let U = cos( alpha N + phi ) - cos( phi ) Let V = cos( alpha N - alpha + phi ) - cos( -alpha + phi ) Z_n = M/(2N) * ( U exp( i beta_n ) - V ) / ( cos( alpha ) - cos( beta_n ) ) No squiggly equal signs were used in their derivation, they are exact. The normalization factor is 1/N. That's the bin value formulas (aka leakage). rbj thought exact frequency determination was already solved. He didn't provide a link or anything more. You didn't make any assertion about this, so I'm not expecting you to come up with one. On your estimators page 2 http://www.ericjacobsen.org/fe2/fe2.htm The variance and your biases are in the order of 10^(-4) in the noiseless case. In the sample in my blog article, the answer is precise to at least eleven decimal places on input that is provided to eleven decimal places. If you think Candan (or anyone else) has a better one than that, a real citation (not behind a paywall) would be appreciated there too. You can't do better than exact. There were no squiggly equal signs used in the derivation of my frequency formula either. [...snip...]
> >Eric Jacobsen >Anchor Hill Communications >http://www.anchorhill.com
Given your interest on the topic, I would think that you would want to evaluate my frequency formula against yours in noiseless and noisy conditions. Then again, maybe you don't care. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Mon, 25 May 2015 07:53:20 -0500, Cedron wrote:

>>>On Sat, 23 May 2015 12:10:22 -0500, JCO_DSP wrote: >>> >>>> Hi, >>>> >>>> I'm starting to learn DSP (Matlab ) >>> >>>If you are equating knowing Matlab with knowing DSP, then your error >>is >>> >>>insurmountable until you understand that DSP is a thing you do, >>>mathematics is the tool you use to understand it, and Matlab is a tool >> >>>you use, _after_ you understand the math, to do the math. >>> >>>-- >>>www.wescottdesign.com >> >>Tim, I completely disgree with you. What you are saying is originally >>from that guy 'Vlad' who has vanished. >>DSP is the product of programming and observing patterns of data then >>coming out with some statements and plots. > > [...snip...] > > >>Kaz --------------------------------------- >>Posted through http://www.DSPRelated.com > > Tim, I have to agree with Kaz on this one. When I first read your post, > I thought it was unduly harsh and discouraging. Mathematics has often > been described as syntactic encapsulation of patterns. Seeing the > patterns first makes it way easier to understand the mathematical > statement that describes them. That is in accordance with the > Scientific Method, in which the first two steps are making observations > and then formulating a hypothesis. In reverse, when you are learning > what a mathematical statement means, it is generally quite useful to see > an example of the pattern that the statement describes to understand it > better. So to the OP, keep playing around, keep asking questions, and I > hope you are enjoying learning. > > Speaking of comp.dsp negative nellies/bullies, Rune also appears to be > gone.
I'm sorry that you feel that way. Matlab will tell you that 1+1 = 2. But it won't tell you that 1+1+1+1+... tends to infinity. If you don't know the latter, then you don't know enough math to understand DSP theory. -- www.wescottdesign.com
[...snip...]

Vladimir V., is that you?  Or just another angry dude?

Let me try to answer for the OP.

> >Why on Earth would anyone use Fourier transform to measure the frequency >of a simple audio signal ?
Because it is a stepping stone to understanding how to deal with more complicated signals.
>And why do you think regular "experts" is this group are giving you >correct answers ? >
They are more likely to give consensus answers that are hopefully correct. If they don't, someone else will call them out. The resulting discourse can be both entertaining and educational.
>Google is your friend: >http://www.google.com/patents/US7124075 >http://www.gamedev.ru/flame/forum/?id4654
Patent abuse for obvious ideas are a whole another topic. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Mon, 25 May 2015 16:10:53 +0000, glen herrmannsfeldt wrote:

> kaz <37480@dsprelated> wrote: >>>On Sat, 23 May 2015 12:10:22 -0500, JCO_DSP wrote: >>>> I'm starting to learn DSP (Matlab ) > >>>If you are equating knowing Matlab with knowing DSP, then your error is > >>>insurmountable until you understand that DSP is a thing you do, >>>mathematics is the tool you use to understand it, and Matlab is a tool >>>you use, _after_ you understand the math, to do the math. > (snip) > >> Tim, I completely disgree with you. What you are saying is originally >> from that guy 'Vlad' who has vanished. > > I think the right answer is somewhere in between. > > If you teach DSP using Matlab as a learning tool, it should work. > > But Tim is right that you do have to understand what you are doing.
Aside from the absurd cost model, Matlab is a fine tool for experimenting to make sure that your theoretical constructs do what you expect. I use Scilab for exactly that -- which is your "Matlab as a learning tool". Matlab (or Scilab) is also a fine tool for crunching lots of numbers _after_ you have used theoretically sound methods to determine the details of the number crunching algorithms. But if you think that typing y = fft(x); plot(abs(y)) means that you thoroughly understand the FFT, then you've been mislead. -- www.wescott design.com
Cedron <103185@DSPRelated> wrote:

>Vladimir V., is that you? Or just another angry dude?
>>Why on Earth would anyone use Fourier transform to measure the frequency >>of a simple audio signal ?
>Because it is a stepping stone to understanding how to deal with more >complicated signals.
In my world, you look for a clear reason to use a transform instead of using a time-domain approach. The first three values from an autocorrelation can tell you the frequency of that signal. (And it will be the same answer, given very broad assumptions.) Steve