DSPRelated.com
Forums

Question about DSP in Matlab (beginner)

Started by JCO_DSP May 23, 2015
On 5/26/15 1:04 AM, Cedron wrote:
> [...snip...] >>> >>> 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. >> >> >> okay, i only barely remember any of this. maybe i blew it off, Ced. >> sorry. >
...
> >> now i know what alpha >> and beta_n are. can i take it that your formula solves for alpha in a >> closed form from Eq. 17? alpha appears 4 places in that equation. > > No, alpha only appears once in (17), on the left hand side. It appears > twice in (16). I had to put a line break in some of the equations because > of the limited display width. >
i'm looking at http://www.dsprelated.com/showarticle/771.php and alpha appears 4 places on the right hand side of Eq. 17. that is as far as i have gotten in your derivation.
>> do >> you have an expression for alpha in terms of all of the Z_n (which are >> the bins of the FFT)? what is it? and, seems to me, that this analysis >> >> is dependent on a rectangular window (or, as Eric and i debated 20 years >> >> ago, no window at all). > > Yes. I prefer the "no window at all" point of view.
yeah, and that's where we totally disagree. unless the frequency lies directly on an integer DFT bin value.
> As I explain later, > the nature of the weighting vector makes it as though there is a virtual > near VonHann window being applied.
lost me there too. i understand how you get to Eq. 17 in the first page (771), and you have an equation relating Z_n to an expression with alpha appearing 4 places. but after that it looks like gobbledygook. it might *not* be gobbledygook, but i am not on par with it. now, my understanding is that you have either N equations or N/2 equations where there is a known value of Z_n equal to the expression with alpha on the right. as best as i can tell, you must choose an alpha that fits those N or N/2 equations best. is that what you're doing? or are you doing it for just those Z_n that exist around an apparent peak?
>> >> i wanna see a nice clear expression of alpha in terms of the Z_n bins in > > That would be (17), (18), and (19). Only three bins are used. I solved > the equations for three adjacent bins, but any three or more bins could be > used.
okay, from those three bins you solve for frequency, amplitude, and phase of a sinusoid, right? ...
> >> wanna use) the frequency, phase, frequency sweep-rate, amplitude, and >> amplitude ramp-rate of a frame of audio that was windowed off with a >> gaussian window. *if* you assume no leakage from other components (or >> the negative frequency component) because of the rapid attenuating skirt >> >> of the gaussian window in the frequency domain, then you can "estimate" >> >> those parameters pretty dang directly and i wrote a paper about it in >> 2001: >> https://www.researchgate.net/publication/3927319_Intraframe_time-scaling_of_nonstationary_sinusoids_within_the_phase_vocoder >> >> . don't squeal to IEEE that i put it up on ResearchGate. it's the only >> > > I won't. But ResearchGate wants me to register to see it and I don't want > to do that.
i'll try to email you. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Monday, May 25, 2015 at 10:32:49 PM UTC-4, Cedron wrote:
> [...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
"Patent abuse for *obvious* ideas..." Boy, aren't we humble ? What's your name, reclusive math genious? John Nash ? Nope, he died in car accident recently... Alexander Grothendieck ? Nope, he died too... Maybe Grisha Perelman ? Doubt Grisha would say that, although he would sound more believable calling everything obvious Whether you like it or not, this is a textbook sort of material you and everyone else in DSP field will have to study ... but maybe not yet, patent is still in force and patent holders in US are currently treated like ebola carriers
[...snip...]
> > >i'm looking at http://www.dsprelated.com/showarticle/771.php and alpha >appears 4 places on the right hand side of Eq. 17. that is as far as i > >have gotten in your derivation. >
You are looking at the Bin Value formula derivation. I thought you were referring to the Frequency Formula (its inverse) Yes, there are four alphas in (17). They are not being solved for here, they are an input. The final bin value equation is (25). When you substitute in U and V, alpha will still appear multiple times. [...snip...]
>> >> Yes. I prefer the "no window at all" point of view. > >yeah, and that's where we totally disagree. unless the frequency lies >directly on an integer DFT bin value.
Is it a finite window on an infinite (or at least bigger) signal, or no window on a finite vector space? It may make a difference on your interpretation relative to other concepts, but it doesn't change the formulas.
> >> As I explain later, >> the nature of the weighting vector makes it as though there is a >virtual >> near VonHann window being applied. > >lost me there too. i understand how you get to Eq. 17 in the first page
Again, this concept pertains to (773). Sorry for the misunderstanding.
> >(771), and you have an equation relating Z_n to an expression with alpha > >appearing 4 places. but after that it looks like gobbledygook. it might > >*not* be gobbledygook, but i am not on par with it.
The gobbledygook in (20) is merely the two fractions in (17) being added with a least common denominator.
> >now, my understanding is that you have either N equations or N/2 >equations where there is a known value of Z_n equal to the expression >with alpha on the right. as best as i can tell, you must choose an >alpha that fits those N or N/2 equations best. is that what you're >doing? or are you doing it for just those Z_n that exist around an >apparent peak?
No. In this article, the signal parameters are known from the get go. What it is showing is how to calculate the DFT bin values without doing a summation. In other words, how do bin values (leakage) depend on the signal. The "Qualitative Analysis" explains how the equation describes the known behavior of non-integer frequency pure tones. The bin index is not limited. It works in the negative direction and wraps around in either direction.
> >>> >>> i wanna see a nice clear expression of alpha in terms of the Z_n bins >in
For that you need to look in the Exact Frequency article (773).
>> >> That would be (17), (18), and (19). Only three bins are used. I >solved >> the equations for three adjacent bins, but any three or more bins >could be >> used. > >okay, from those three bins you solve for frequency, amplitude, and >phase of a sinusoid, right? >
Yes. An exact solution. Solving for the frequency is in (773), the amplitude and phase in (787) titled "Phase and Magnitude Calculation for a Pure Real Tone in a DFT: Method 1" [...snip...]
> >i'll try to email you. >
Okay. You should have my email address from before. I don't see anything yet so I will email you a quick message right now. I don't know how to access, or if I even can, the dsprelated email address that gets tagged on these posts. Thanks for looking at this, Ced
> >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge."
--------------------------------------- Posted through http://www.DSPRelated.com
[...snip...]

>"Patent abuse for *obvious* ideas..." > >Boy, aren't we humble ? >What's your name, reclusive math genious? >John Nash ? Nope, he died in car accident recently... >Alexander Grothendieck ? Nope, he died too... >Maybe Grisha Perelman ? Doubt Grisha would say that, although he would >sound more believable calling everything obvious > >Whether you like it or not, this is a textbook sort of material you and >everyone else in DSP field will have to study ... but maybe not yet,
patent
>is still in force and patent holders in US are currently treated like >ebola carriers
I didn't know it was your patent. I thought you were just throwing up a helpful link. I made my comment after a brief scan of the patent. I went back to look at it more carefully later and still don't see what the "special trick" is. Patents are hard to read. When I get mine, I'll send you a link and you can call it obvious if it will make you less angry. Your reply was rather insulting so I don't feel bad I insulted you. A few years back I took a stab at the analysis of a real chaotic signal coming from the Hall effect of "novel sensor technology for measuring electromagnetic signatures of materials". I, too, kicked it up into phase space in multiple state vectors with, if I may say so, considerably more sophisticated techniques than I saw in your patent. It made really pretty graphs, but I was unable to achieve the material discrimination ability that was being sought. There is an awful lot of "patent squatting" going on, particularly in the software arena, which is actually hindering technological progress rather than encouraging it, which is what patents were intended to do. As I said, this is a whole different topic of discussion. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Mon, 25 May 2015 22:51:34 -0400, robert bristow-johnson
<rbj@audioimagination.com> wrote:

>On 5/25/15 10:32 PM, Tim Wescott wrote: >> On Mon, 25 May 2015 07:53:20 -0500, Cedron wrote: >> >... >>> >>> 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 haven't heard from either, neither. Rune ... Vlad ... pussycats.
Rune hasn't been around for a long, long time. Not sure why. Probably outgrew us.
>> >> 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. > >to different degrees. there are a few "civilians" (often audio majors >at some school) that might be able to understand some stuff by just >tooling around MATLAB. but depth of understanding requires some formal >math vocabulary. however, when i am at the dsp.stackexchange.com site, >there are those who are far more mathematically "sophisticated" than me >(they worry about ROC more than i do). i mean, it's been 35 years since >grad school and i couldn't tell you shit about how to derive a Kalman >filter anymore. > >bestest regrads (lest i be cast among the negative nellies/bullies of >comp.dsp).
Too late! ;)
>-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > >
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On 5/26/15 10:35 AM, Cedron wrote:

>>> >>> Yes. I prefer the "no window at all" point of view. >> >> yeah, and that's where we totally disagree. unless the frequency lies >> directly on an integer DFT bin value. > > Is it a finite window on an infinite (or at least bigger) signal, or no > window on a finite vector space? It may make a difference on your > interpretation relative to other concepts, but it doesn't change the > formulas.
i looked at the 773 article and your Eq 17 (and 18 and 19) appears to be okay. 3 equations and 3 unknowns. knowing your window (it is rectangular, hence the finite summation in the previous 771 Eq 17), and knowing 3 points (and, of course, the cannot be 3 zero points), then you can solve directly for 3 parameters: amplitude, frequency, and phase. it has to mean that there is no noise nor other frequency components (not even DC). 3 equations, 3 unknowns. you could also do it in the time domain (unless your 3 points are poorly selected). again, no noise nor interference is allowed. i'm more interested in determining parameters embedded into signals when there is some kind of deviation from the ideal. perhaps noise or perhaps interference from other signals. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Once again, Steve Pope's got it. 

In the meantime, readers of this newsgroup are once again invited to enjoy yet another little comp.dsp civil war. 
On Mon, 25 May 2015 21:14:34 -0500, "Cedron" <103185@DSPRelated>
wrote:

>[...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.
I told you where to look.
> >[...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.
I sent you in the direction of the answer. If you're not willing to make the trip, you are unlikely to get what you asked for.
>[...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.
Candan has written a lot on the topic. So, rather than pick a citation and then have you say it wasn't complete or complain about it in some other manner, and then have to send you to another one, I thought I'd let you explore on your own since you know better than I what you will or will not find adequate or interesting. You asking a question does not obligate me to do work for you. I gave you a pretty direct arrow to a source for what you asked for. If you're not really interested enough to look through it, and he gives very helpful, appropriate titles to his papers, then why should I be burdened with the task?
>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.
I think it would be better if you did your own research to answer your own question. Again, I sent you directly to one very good source. You can take it from there. I won't try to guess which papers you'll like and which you won't, as there are more than one. As I also mentioned, others have done similar work, and sometimes they cite Candan's work, so even if you don't like his stuff there's a lot more out there. No, I'm not going to do that work for you, either.
>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.
There was a guy that posted here many years ago that claimed he could do that, and years later came back with an "exact" derivation as well that he went way out of his way to share with me privately. AFAIK it was never published, and it's not mine so I can't share it. It didn't look anything like yours, either. I didn't agree that it was "exact" because of the approach, but that was his position. The point there is just that this has been done a number of times by various people from various different approaches. Including you, off the top of my head I think I've seen at least four different people come up with similar analyses, and a lot more that were brief to show "sufficiency". Because they had different perspectives, they tend to look different from each other. Candan did it because nobody had come up with a detailed explanation for why my estimator worked as well as it did. I'd come up with mine heuristically, like MacLeod did with his. A lot of people were using mine in various applications and Candan's interest was radar, where the SNR is typically high. My application was communications, where performance at low SNR was of more interest. I knew a few people had taken a crack at coming up with a derivation but AFAIK Candan was the only one that got anywhere that I know of. His results were interesting because a correction term dropped out that removed some bias that dominated performance at high SNR. I'd never noticed that bias bothering performance, because I was never interested in high SNR performance and the bias disappeared at low SNR. In a subsequent paper he took it a little further and came up with some more adjustments, which work well but add complexity, and recently published an approach that includes non-rectangular windows. So you can peruse those and see what interests you and what doesn't. I won't guess which do and which don't.
>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.
There are lots and lots of estimators, even three-term estimators, which all offer tradeoffs of bias and variance performance against complexity. There are also dichotomous search methods that are popular these days, which have their own tradeoffs, but certainly have their place. Mine was, at the time, popular because it had very good (not necessarily best) performance with very low complexity. It offered a sweet spot in the complexity/performance tradeoff that wasn't previously available. These days "complexity" doesn't have the same cost or significance in many applications as it did back then, and applications have gotten more focused, so the nuances of the various estimators and methods have favored some in some applications and others in other applications. That's pretty normal, I think. As I mentioned, Candan was interested in radar processing, so his focus was on what he needed for that application. For other applications other methods may be favored, and somebody else already mentioned the CERN paper, which takes an entirely different approach to what some might see as the same problem warmed over again. So I don't really care how yours compares because there's already a whole ecosystem of these things out there, and the people who use them have their own tradeoff space to deal with and seem to do a reasonable job of picking what works for them and what doesn't. Mine is still kinda nice because it is very low complexity, but the tradeoffs are now well known and if people need better, they have plenty of options to pick from, including Candan's, which are built on mine, and a host of others. Many people are even moving away from three-term estimators and doing other crazy things which provide advantages in certain situations. That's a normal evolution of things as complexity becomes less expensive. The dichotomous search methods are kinda cool because you can pick how well you need it to perform. If you need better performance, run more iterations. When you have enough, you can stop. That's pretty nice when you can afford the complexity and latency, which in many cases these days you can. I occasionally review papers in this area for Elsevier and the IEEE, and there's still a fair amount of work being done with new ideas and new twists on old ones. Things have certainly not stood still, and the quantity of methods and approaches to pick from is high.
>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.
They are too many to list. If you're interested they're just google searches away. I already pointed you to a very good place to start.
>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
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
[...snip...]
> >i looked at the 773 article and your Eq 17 (and 18 and 19) appears to be > >okay. >
Thanks for taking a look. Just okay? I was hoping for impressive, or at least novel.
>3 equations and 3 unknowns. knowing your window (it is rectangular, >hence the finite summation in the previous 771 Eq 17), and knowing 3 >points (and, of course, the cannot be 3 zero points), then you can solve > >directly for 3 parameters: amplitude, frequency, and phase. it has to >mean that there is no noise nor other frequency components (not even >DC).
In order to be exact, correct. However, the frequency equation is fairly robust, but no longer exact, in the presence of noise. The equations you get for amplitude and phase are very sensitive to noise. That is why I don't present them and take a different approach in my last blog article. Jacobsen's estimator, without the bias correction, is actually sort of an approximation of (17) so I would expect the noise impact characteristics to be similar. Unless the three bin set covers the DC bin, a DC offset will have no effect. Other tones will, but I will deal with that when I get to the multiple tone case.
> >3 equations, 3 unknowns. you could also do it in the time domain >(unless your 3 points are poorly selected). again, no noise nor >interference is allowed.
The advantage of doing it in the frequency space, the DFT bins, is that the noise will be spread out over all the bins and thus only the noise that impacts the three bins will have any effect. So the DFT is acting as a noise filter.
> >i'm more interested in determining parameters embedded into signals when > >there is some kind of deviation from the ideal. perhaps noise or >perhaps interference from other signals. >
I have classified these blogs under 'Basics' because they are really dealing with the fundamentals of the DFT. Stay tuned for the multiple tone case. I am not sure I will do an article on the impact of noise. I am simply not knowledgeable enough to get the terminology right. You can look at (18) from (773) as: cos( alpha ) = WBZ / WZ If you add an error component to the DFT it becomes: = WB(Z+E) / W(Z+E) = WBZ / (WZ + WE) + WBE / (WZ + WE) If E is fairly small, WE << WZ and the following approximation can be made to both terms: 1/(WZ + WE) = 1/[WZ(1 + WE/WZ)] ~=~ (1 - WE/WZ)/WZ plugging that back in gets you to: cos( alpha ) = WBZ / WZ + (terms with E in them) The thing to note is that W is roughly ( -1, 2, -1 ) so any constant or linear runs in E (bin values from other tones are roughly linear farther away) get pretty much wiped out.
> >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge."
Thanks for your 'okay', it is the first direct acknowledgement I have received. I truly do appreciate it. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On 5/26/15 12:20 PM, julius wrote:
> Once again, Steve Pope's got it. > > In the meantime, readers of this newsgroup are once again invited to enjoy yet another little comp.dsp civil war.
over what? pro-MATLAB vs. anti-MATLAB ? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."